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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    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.

Set slot doesn't work for inventory and neither does format slot.

Discussion in 'Skript' started by Sam1370, Jun 14, 2017.

Thread Status:
Not open for further replies.
  1. Sam1370

    Sam1370 Member

    Joined:
    Jun 11, 2017
    Messages:
    17
    Likes Received:
    1
    Skript Version: Skript 2.2 (dev20c)
    Skript Author: Bensku
    Minecraft Version: 1.11

    Set slot doesn't seem to work (and neither does format slot.) I'm trying to set a slot in the player's hotbar to a selector compass and it doesn't seem to work.

    Code:
    Code (Skript):
    1. on join:
    2.     player's world is "world":
    3.         wait 1 tick
    4.         set slot 36 of player's current inventory to compass named "&aSelector" with lore "&9Select something to do!"
    5. on right click:
    6.     if player is holding compass named "&aSelector":
    7.         wait 1 tick
    8.         open virtual dispenser inventory named "&a&nSelector" to player
    9.         format gui slot 4 of player with grass block named "&aSurvival" with lore "&9Play vanilla survival" to close then run function doSomething()
    10. function doSomething():
    11.     broadcast "And it did"

    Addons using (including versions):

    SkQuery Lime 3.5.7, TuSKe 1.7.7.
     
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Functions must run before events that contains the function. So in this case, put the function at the top of the code.
     
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Also, for the "set slot" one it should just be "player's inventory" not "player's current inventory" and idk if you were just testing stuff but slot 36 is the boots slot (hotbar is 0-8).

    If you're just setting an item in a player's inventory you should definitely be using "set slot" not tuske GUIs
     
    #3 ShaneBee, Jun 14, 2017
    Last edited by a moderator: Jun 14, 2017
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Thank you!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...