2nd layer GUI doesn't work

  • 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 community!

    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.

ItzInferno69

Member
Dec 18, 2019
3
0
0
Hello there. I've got an issue with my Skript. I have this central GUI command, from which people can click to run other commands. However, as soon as someone has to click a second time, the GUI doesn't work: when the item is unstealable, you can still steal it, or when the item is supposed to run a command, you can just take the item, but the command doesn't run. For most commands, however, it works when I directly type the commands and then click further (again, only the first time). I don't get any error messages.

Here's an example of a "second layer" that is supposed to work but doesn't:

Code:
command /tpgui:
    permission: gui.tp
    trigger:
        wait 2 ticks
        open chest with 3 rows named "&cTeleport GUI" to player
        set {_s} to 0
        loop all players in player's world:
            loop-player isn't player:
                format slot {_s} of player with skull of loop-player named "&6%loop-player%" with lore "&cClick to teleport!" to close then run [execute console command "/tp %player% %loop-player%"]
                add 1 to {_s}
 
Hello there. I've got an issue with my Skript. I have this central GUI command, from which people can click to run other commands. However, as soon as someone has to click a second time, the GUI doesn't work: when the item is unstealable, you can still steal it, or when the item is supposed to run a command, you can just take the item, but the command doesn't run. For most commands, however, it works when I directly type the commands and then click further (again, only the first time). I don't get any error messages.

Here's an example of a "second layer" that is supposed to work but doesn't:

Code:
command /tpgui:
    permission: gui.tp
    trigger:
        wait 2 ticks
        open chest with 3 rows named "&cTeleport GUI" to player
        set {_s} to 0
        loop all players in player's world:
            loop-player isn't player:
                format slot {_s} of player with skull of loop-player named "&6%loop-player%" with lore "&cClick to teleport!" to close then run [execute console command "/tp %player% %loop-player%"]
                add 1 to {_s}
The problem is that you have to insert "gui" between "format" and "slot". Here is a fixed code.

Code:
command /tpgui:
    permission: gui.tp
    trigger:
        wait 2 ticks
        open chest with 3 rows named "&cTeleport GUI" to player
        set {_s} to 0
        loop all players in player's world:
            loop-player isn't player:
                format gui slot {_s} of player with skull of loop-player named "&6%loop-player%" with lore "&cClick to teleport!" to close then run [execute console command "/tp %player% %loop-player%"]
                add 1 to {_s}
 
The problem is that you have to insert "gui" between "format" and "slot". Here is a fixed code.

Code:
command /tpgui:
    permission: gui.tp
    trigger:
        wait 2 ticks
        open chest with 3 rows named "&cTeleport GUI" to player
        set {_s} to 0
        loop all players in player's world:
            loop-player isn't player:
                format gui slot {_s} of player with skull of loop-player named "&6%loop-player%" with lore "&cClick to teleport!" to close then run [execute console command "/tp %player% %loop-player%"]
                add 1 to {_s}
Thank you for your reply! However, everywhere I add "gui", I get an error message... am I doing something wrong?
 
Thank you for your reply! However, everywhere I add "gui", I get an error message... am I doing something wrong?
If you are using "format gui slot" then there should be nothing wrong. Can you give me the code that gives you an error message?
[doublepost=1576707979,1576699372][/doublepost]Or could you at least send me the error you get?
 
If you are using "format gui slot" then there should be nothing wrong. Can you give me the code that gives you an error message?
[doublepost=1576707979,1576699372][/doublepost]Or could you at least send me the error you get?
Code:
There's no loop that matches 'loop-player named "&6%loop-player%" with lore "&1Click to teleport!" to close then run [execute console command "/tp %player% %loop-player%"]' (tpgui.sk: format gui slot {_s} of player with skull of loop-player named "&6%loop-player%" with lore "&1Click to teleport!" to close then run [execute console command "/tp %player% %loop-player%"]')

This is the error message I get, and when I leave "gui" out, I don't get this error message. Maybe I'm missing an addon? (I'm currently using Skript, SkQuery, and TuSKe, and I tried all combinations of those three to get it to work but it still doesn't)
 
I would use "loop all players:" instead of "loop all players in player's world" cuz idk if "loop all players in player's world:" is a valid expression but it might be
[doublepost=1576782375,1576781459][/doublepost]Oh! You can't do "skull of loop-player". You have to smth like "player skull ("nerd" parsed as offline player)" but idk
[doublepost=1576790787][/doublepost]Wait, nvm. Skull of loop-player is a valid expression. I would recommend using loop-player's skull as it uses less words however
 
Status
Not open for further replies.