Update GUI slot

  • 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.

Mattllama987

Active Member
Aug 5, 2018
225
7
18
24
Hello, i need help with a little something. Ive never really understood how to make a GUI auto update a slot. Im working on a Admin Menu, and want to check a few things that would need to be updated in a slot in the gui. What i have now gives no errors, but wont format the slot. It just stays blank and the players skull isnt there. So if someone know how to fix this, please let me know ASAP.

Server: 1.14.4
Skript: 2.4.1

Thanks!
~Matt

Also not sure why the indentation is off :emoji_slight_smile:

Code:
while name of player's current inventory is "&c&lAdmin Menu":
                    set slot 13 of current inventory of player to player's skull named "" with lore "%player's ping%"
                    wait 1 seconds
 
Can you give us a bit more code, if this was meant to be an event, there is no event as such.
 
Can you give us a bit more code, if this was meant to be an event, there is no event as such.
Ill post the full thing. But the part at the bottom is what im stuck on. The While part.


Code:
command /menu:
    trigger:
        if player has permission "admin.menu":
            open chest with 6 rows named "&c&lAdmin Menu" to player
            format gui slot 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 50, 51, 52 and 53 of player with black stained glass pane named ""
            set {_num} to 0
            loop 10 times:
                format gui slot {_num} of player with black stained glass pane named ""
                add 1 to {_num}
            format gui slot 49 of player with barrier named "&c&lClose" to close
            format gui slot 10 of player with lever named "&a&lRestart Server" with lore "&5&lThis will restart the server" and "&5&land kick all players!" to run:
                execute console command "restart"
            format gui slot 11 of player with glowing paper named "&a&lReset everyone's balance" with lore "&7&lThis will reset all player's" and "&7&lbalances on the server" to run:
                execute command "/eco reset **"
                send "&c&l[Menu] &7Reset everyones balance!"
            format gui slot 12 of player with redstone named "&c&lChange GameMode" with lore "&7&lChange your gamemode" to run:
                if player's gamemode is creative:
                    set player's gamemode to survival
                    send "&c&l[Menu] &7You are now in Survival!"
                else if player's gamemode is survival:
                    set player's gamemode to creative
                    send "&c&l[Menu] &7You are now in Creative!"
                while name of player's current inventory is "&c&lAdmin Menu":
                    set slot 13 of current inventory of player to player's skull named "" with lore "%player's ping%"
                    wait 1 seconds
[doublepost=1579158247,1579025064][/doublepost]Bump
 
A possible solution would be to set a variable when the player opens the gui, then delete it once they close the gui.
And then say

Code:
while {temp.%player%} is set:
    set slot...
    wait 1 second
 
That sure did it! Thank you, and have a fantastic day! :emoji_slight_smile:
[doublepost=1579202048,1579201123][/doublepost]Okay, but now it shows the slot in every GUI i open. Ive tried a few ways to not let that happen. But every menu i open, slot 13 will be the players head.
[doublepost=1579202116][/doublepost]Here is what i have now:

Code:
command /menu:
    trigger:
        if player has permission "admin.menu":
            open chest with 6 rows named "&c&lAdmin Menu" to player
            set {temp::%player%} to true
            format gui slot 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 50, 51, 52 and 53 of player with black stained glass pane named ""
            set {_num} to 0
            loop 10 times:
                format gui slot {_num} of player with black stained glass pane named ""
                add 1 to {_num}
            format gui slot 49 of player with barrier named "&c&lClose" to close
            format gui slot 10 of player with lever named "&a&lRestart Server" with lore "&5&lThis will restart the server" and "&5&land kick all players!" to run:
                execute console command "restart"
            format gui slot 11 of player with glowing paper named "&a&lReset everyone's balance" with lore "&7&lThis will reset all player's" and "&7&lbalances on the server" to run:
                execute command "/eco reset **"
                send "&c&l[Menu] &7Reset everyones balance!"
            format gui slot 12 of player with redstone named "&c&lChange GameMode" with lore "&7&lChange your gamemode" to run:
                if player's gamemode is creative:
                    set player's gamemode to survival
                    send "&c&l[Menu] &7You are now in Survival!"
                else if player's gamemode is survival:
                    set player's gamemode to creative
                    send "&c&l[Menu] &7You are now in Creative!"
            format gui slot 14 of player with glowing paper named "&bAdd &a$1M" to run:
                add 1000000 to player's balance
            while {temp::%player%} is true:
                set slot 13 of current inventory of player to player's skull named "" with lore "&6Ping: &a%player's ping%" and "&6Balance: &a%player's balance%"
                wait 1 ticks
on inventory close:
    set {temp::%player%} to false

EDIT: I think i might have found the issue.
 
Last edited:
You can use
Code:
if name of player's current inventory is "blah blah"
 
Status
Not open for further replies.