How can I give a Item from GUI to player (SkQuery)

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Daskomiko

New Member
Apr 23, 2021
6
0
1
24
Hey I have a question:
I'm trying to open a GUI with random items and the item that you click on should be given to the player. How do I do that? It doesn't work with me. This is my code:


command /randomitems:
trigger:
wait 1 tick
open chest with 1 rows named "Such dir ein Item aus" to player
wait 1 tick
format slot 0 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 1 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 2 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 3 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 4 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 5 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 6 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 7 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 8 of player with a random element out of all items to run [execute console command "custom-command"]

on inventory click:
if inventory name of player's current inventory is "Such dir ein Item aus":
if event-item is not barrier:
give event-item to player

command /custom-command:
trigger:
send "" to player
 
Hey I have a question:
I'm trying to open a GUI with random items and the item that you click on should be given to the player. How do I do that? It doesn't work with me. This is my code:


command /randomitems:
trigger:
wait 1 tick
open chest with 1 rows named "Such dir ein Item aus" to player
wait 1 tick
format slot 0 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 1 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 2 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 3 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 4 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 5 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 6 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 7 of player with a random element out of all items to run [execute console command "custom-command"]
format slot 8 of player with a random element out of all items to run [execute console command "custom-command"]

on inventory click:
if inventory name of player's current inventory is "Such dir ein Item aus":
if event-item is not barrier:
give event-item to player

command /custom-command:
trigger:
send "" to player

Don't use SkQuery.
 
Status
Not open for further replies.