Skript not working?

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

LeeifMR

Member
Oct 2, 2024
24
0
1
19
I have this script, which should not allow players to go below y 34 without the correct key, but it's not working, how come?
Code:
options:
    key-item: deepslate brick wall

on player move:
    if player's y-coordinate < 34:
        if player's tool is not {key-item}:
            send "&cYou do not possess the correct key to enter the deep mines!" to player
            set player's location to player's previous location
 
Hello!

There are multiple things that could happen.

Firstly, it is checking for only below y-34. If you have a floor at exactly there, and their y-coordinate is exactly y-34, it won't work. Make sure it's "y-coordinate of player <= 34"!

Additionally, skript checking variables as items can be buggy sometimes. If you are holding a deepslate brick wall with nbt, for example a name, it will not work. Change the line to "if type of player's tool is not deepslate brick wall:".

If that still doesn't work, make sure to debug! I personally would add an "else: send [number]" to player to see what's wrong. If it's the line about the player's tool, it's probably because you have multiple of a tool, to which you would change "type of player's tool" to "type of 1 player's tool", though that usually only fixes problems if it's the player's tool and not its type.