Solved Close inventory

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

ezmann!44

Member
Jul 2, 2017
35
1
0
26
I made a script which will close the inventory of a player if they click the

outside part of the GUI (the dark stuff)

code_language.skript:
on inventory click:
    if "%clicked item%" is "<none>":
        close player's inventory

It works, but sometimes I accidentaly click it, and it will close the GUI for me, and I'll have to re open it. Is it possible to make it so you have to click it twice, before the GUI closes?

I tried to make it possible with variables, but it is not good with variables, because if the server crashes or something, the variables won't get deleted. Also i'm sure there is a better way to do it.

So if anyone knows, then please help me, and I can maybe make it into a resource, and give you a shoutout in the post. :emoji_slight_smile:
 
I dont see any way besides variables
code_language.skript:
on inventory click:
    if "%clicked item%" is "<none>":
        add 1 to {num_of_clicks::%player%}
        if {num_of_clicks::%player%} is 2:
            close player's inventory
            set {num_of_clicks::%player%} to 0

on inventory open:
    set {num_of_clicks::%player%} to 0
with this ^ it doesnt matter if the server crashes because every time the player opens the inventory the number of clicks gets reset to 0
 
Status
Not open for further replies.