Solved Unable to change a variable while in a GUI.

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

johnpaulbin

Member
Mar 17, 2020
2
0
1
Skript Version (do not put latest): Skript 2.2 (dev20c)
Skript Author:
Minecraft Version: 1.15.2

Code:
variables:
    {daynightcycle} = true
    {defaultgamemode} = survival #0 = adventure, 1 = survival 2 = creative, 3 = spectator. What gamemode a person will get on first join.
    
command /scontrol:
    permission: operator
    trigger:
        open chest with 1 rows named "&l&rControl Panel" to player
        wait 1 tick
        if {@daynightcycle} is true:
            format gui slot 0 of player with lime stained glass pane named "Day / Night Cycle" with lore "%{daynightcycle}%" to close then run [set {daynightcycle} to false]
        else:
            format gui slot 0 of player with black stained glass pane named "Day / Night Cycle" with lore "%{daynightcycle}%" to close then run [set {daynightcycle} to true]

upload_2020-3-18_12-26-4.png
 
You even posted this on the Minehut discord. ;^; Anyways, first {daynightcycle} is not an option so you had to remove the @. Here, try this.
Code:
variables:
    {daynightcycle} = true
    {defaultgamemode} = survival #0 = adventure, 1 = survival 2 = creative, 3 = spectator. What gamemode a person will get on first join.
  
command /scontrol:
    permission: operator
    trigger:
        open chest with 1 rows named "&l&rControl Panel" to player
        wait 1 tick
        if {daynightcycle} is true:
            format gui slot 0 of player with lime stained glass pane named "Day / Night Cycle" with lore "%{daynightcycle}%" to run:
                set {daynightcycle} to false
                close player's inventory
        else:
            format gui slot 0 of player with black stained glass pane named "Day / Night Cycle" with lore "%{daynightcycle}%" to run:
                set {daynightcycle} to true
                close player's inventory
 
Status
Not open for further replies.