You can't make a gui slot outside of a GUI creation or editing session (skript-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!

za_breado

Member
Apr 12, 2024
20
2
3
23
I'm having this strange issue where the last 2 gui related lines of my skript are throwing this error, but the rest of my skript isn't.

Skript Addons: SkBee, skript-gui, Skellet, skRayFall

Code:
code_language.skript:
command /gui:
    trigger:
        create a gui with virtual chest named "&c&lCOMPACTOR" with 1 rows:
            make gui slot 0 to red glass pane named " "
            make gui slot 8 to red glass pane named " "
            if {compactors::%player's uuid%::*} contains "stone":
                make gui slot 1 to stone named "&2&lSTONE ✔"
            else:
                make gui slot 1 to glowing grey wool named "&4&lSTONE ❌"
          
            if {compactors::%player's uuid%::*} contains "coal":
                make gui slot 2 to coal block named "&2&lCOAL ✔"
            else:
                make gui slot 2 to glowing grey wool named "&4&lCOAL ❌"
          
            if {compactors::%player's uuid%::*} contains "iron":
                make gui slot 3 to iron block named "&2&lIRON ✔"
            else:
                make gui slot 3 to glowing grey wool named "&4&lIRON ❌"
          
            if {compactors::%player's uuid%::*} contains "gold":
                make gui slot 4 to gold block named "&2&lGOLD ✔"
            else:
                make gui slot 4 to glowing grey wool named "&4&lGOLD ❌"
          
            if {compactors::%player's uuid%::*} contains "diamond":
                make gui slot 5 to diamond block named "&2&lDIAMOND ✔"
            else:
                make gui slot 5 to glowing grey wool named "&4&lDIAMOND ❌"
          
            if {compactors::%player's uuid%::*} contains "emerald":
                make gui slot 6 to emerald block named "&2&lEMERALD ✔"
            else:
                make gui slot 6 to glowing grey wool named "&4&lEMERALD ❌"
              
            if {docompact::%player's uuid%} is true:
                make gui slot 7 to glowing green wool named "&2&lCOMPACTING ENABLED ✔":
                set {docompact::%player's uuid%} to false
                make gui slot 7 to glowing red wool named "&4&lCOMPACTING DISABLED ❌"
            else:
                make gui slot 7 to glowing red wool named "&4&lCOMPACTING DISABLED ❌":
                set {docompact::%player's uuid%} to true
                make gui slot 7 to glowing green wool named "&2&lCOMPACTING ENABLED ✔"
                  
on inventory click:
        clicked inventory isn't player's inventory
        if inventory name of player's current inventory is "&c&lCOMPACTOR":
            clicked slot = 7
            play sound "entity.experience_orb.pickup" at volume 100 at pitch 1 to player
            if {docompact::%player's uuid%} is true:
                send "&cYour compactor is now disabled." to player
                set {docompact::%player's uuid%} to false
                make gui slot 7 to glowing red wool named "&4&lCOMPACTING DISABLED ❌"
            else:
                send "&2Your compactor is now enabled." to player
                set {docompact::%player's uuid%} to true
                make gui slot 7 to glowing green wool named "&2&lCOMPACTING ENABLED ✔"
            open the last gui for the player
 

Attachments

  • problem.png
    problem.png
    85 KB · Views: 25
Last edited:
I'm also getting lots of indentation errors that don't make sense.

This would make everything 16 lines long, which would cause another indentation error with the if/else statement
 

Attachments

  • problem.png
    problem.png
    90.1 KB · Views: 24
You can't do a gui slot in an on inventory click event (when using skript-gui), at least, not in the way you're doing it, and your indentation errors are because you indented the first clicked slot statement in your on inventory click event, so it expects the entire event to use 2 tabs per indent instead of one.


I don't know skript-gui, and can't offer much further assistance.
I recommend using Skript's vanilla built-in GUI system, but if skript-gui gets the job done, use it.
 
You can't do a gui slot in an on inventory click event (when using skript-gui), at least, not in the way you're doing it, and your indentation errors are because you indented the first clicked slot statement in your on inventory click event, so it expects the entire event to use 2 tabs per indent instead of one.


I don't know skript-gui, and can't offer much further assistance.
I recommend using Skript's vanilla built-in GUI system, but if skript-gui gets the job done, use it.
Thank you for the help.
Would you know any way to create gui elements in an on click event?
 
Thank you so much for your help again! My code now fully functions (from what I have tested), but the format of my code is looking very strange after I did what they asked (attached below), and I am getting empty configuration section errors (also attached below), which is presumably from my awful code formatting
CoffeeScript:
command /gui:
    trigger:
        create a gui with virtual chest named "&c&lCOMPACTOR" with 1 rows:
            make gui slot 0 to red glass pane named " "
            make gui slot 8 to red glass pane named " "
            if {compactors::%player's uuid%::*} contains "stone":
                make gui slot 1 to stone named "&2&lSTONE ✔"
            else:
                make gui slot 1 to glowing grey wool named "&4&lSTONE ❌"
            
            if {compactors::%player's uuid%::*} contains "coal":
                make gui slot 2 to coal block named "&2&lCOAL ✔"
            else:
                make gui slot 2 to glowing grey wool named "&4&lCOAL ❌"
            
            if {compactors::%player's uuid%::*} contains "iron":
                make gui slot 3 to iron block named "&2&lIRON ✔"
            else:
                make gui slot 3 to glowing grey wool named "&4&lIRON ❌"
            
            if {compactors::%player's uuid%::*} contains "gold":
                make gui slot 4 to gold block named "&2&lGOLD ✔"
            else:
                make gui slot 4 to glowing grey wool named "&4&lGOLD ❌"
            
            if {compactors::%player's uuid%::*} contains "diamond":
                make gui slot 5 to diamond block named "&2&lDIAMOND ✔"
            else:
                make gui slot 5 to glowing grey wool named "&4&lDIAMOND ❌"
            
            if {compactors::%player's uuid%::*} contains "emerald":
                make gui slot 6 to emerald block named "&2&lEMERALD ✔"
            else:
                make gui slot 6 to glowing grey wool named "&4&lEMERALD ❌"
                
            if {docompact::%player's uuid%} is true:
                make gui slot 7 to glowing green wool named "&2&lCOMPACTING ENABLED ✔":
                set {docompact::%player's uuid%} to false
                make gui slot 7 to glowing red wool named "&4&lCOMPACTING DISABLED ❌"
            else:
                make gui slot 7 to glowing red wool named "&4&lCOMPACTING DISABLED ❌":
                set {docompact::%player's uuid%} to true
                make gui slot 7 to glowing green wool named "&2&lCOMPACTING ENABLED ✔"
            open last gui to player       
on inventory click:
        clicked inventory isn't player's inventory
        if inventory name of player's current inventory is "&c&lCOMPACTOR":
        clicked slot = 7
        play sound "entity.experience_orb.pickup" at volume 100 at pitch 1 to player
        if {docompact::%player's uuid%} is true:
                send "&cYour compactor is now disabled." to player
                set {docompact::%player's uuid%} to false
                set slot 7 of player's current inventory to glowing red wool named "&4&lCOMPACTING DISABLED ❌"
        else:
                send "&2Your compactor is now enabled." to player
                set {docompact::%player's uuid%} to true
                set slot 7 of player's current inventory to glowing green wool named "&2&lCOMPACTING ENABLED ✔"