1. 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!


    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Close inventory

Discussion in 'Skript' started by ezmann!44, Jul 17, 2017.

Thread Status:
Not open for further replies.
  1. ezmann!44

    ezmann!44 Member

    Jul 2, 2017
    Likes Received:
    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 (Skript):
    1. on inventory click:
    2.     if "%clicked item%" is "<none>":
    3.         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:
  2. Best Answer:
    Post #2 by ShaneBee, Jul 17, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Sep 7, 2017
    Likes Received:
    I dont see any way besides variables
    Code (Skript):
    1. on inventory click:
    2.     if "%clicked item%" is "<none>":
    3.         add 1 to {num_of_clicks::%player%}
    4.         if {num_of_clicks::%player%} is 2:
    5.             close player's inventory
    6.             set {num_of_clicks::%player%} to 0
    8. on inventory open:
    9.     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
Thread Status:
Not open for further replies.

Share This Page