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.

What's wrong with this script?

Discussion in 'Skript' started by Raenzil, Jan 23, 2023.

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

    Raenzil Member

    Jan 23, 2023
    Likes Received:
    I am trying to make a script that prevent players to click an iron sword that doesn't have custom model data. But the script below will always cancel the clicking no matter the clicked sword has a custom model data or not. I wonder what could be wrong in the codes?

    Script Version: 2.6.3

    Minecraft Version: 1.19.3

    Full Code:
    Code (Text):
    1. on inventory click at iron sword:
    2.     send "1!"
    3.     if event-item doesn't have custom model data:
    4.         send "2!"
    5.         cancel event
    Other Useful Info:
    Server Version: Purpur 1.19.3-1900

    No addons using

    Have you tried searching the docs? Yes.
    Have you tried searching the Forums? Yes.
    What other methods have you tried to fix it?
    I also tried the example of On Inventory Click event in the doc:
    Code (Text):
    1. on inventory click:
    2.     if event-item is stone:
    3.         give player 1 stone
    and it don't work for me too. Nothing happens when clicking a stone.
    #1 Raenzil, Jan 23, 2023
    Last edited: Jan 23, 2023
  2. Merrical


    Jul 27, 2020
    Likes Received:
    when looking for an inventory click, you want to check the event-slot. examples of this could be:
    Code (Text):
    1. on inventory click:
    2.     if index of event-slot = 10:
    3.         send "clicked the 10th slot of this inventory"
    4.     if event-slot is an iron ingot:
    5.         send "this slot is an iron ingot"
    6.     else:
    7.         send "this slot is an %event-slot%"
    If you look at the skhub docs, https://skripthub.net/docs/?id=1090
    You can see that event-item does not exist. to get the item type, you use event-slot.
Thread Status:
Not open for further replies.

Share This Page