Solved Failed to check if player is holding an enchanted item

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

mtrD359360

Member
May 2, 2017
17
1
0
22
Skript Version: Skript 2.4.1
Skript Author: Bensku
Minecraft Version: 1.12.2

I want to check if a player is holding an item as follow:
Code:
on right click:      
    if player's tool is Name Tag of Unbreaking 5:
        (do something)
But when I use a Name Tag with Unbreaking 5 enchantment to right click something, the if doesn't count as true .
I've also tested this, but neither works:
Code:
on right click:      
    if player is holding Name Tag of Unbreaking 5:
        (do something)

While I changed the code a bit, like this:
Code:
on right click:      
    if player's tool is Name Tag:
        (do something)
It does work, the action in the "if" runs.
What is the problem? Or any alternative code I can use to get the same result?

Addons using (including versions):
TuSKe 1.8.2
 
Last edited:
Code:
On rightclick:
  if player's tool is Name tag:
    if lore of player's tool contains "Unbreaking V":
      # do stuff
 
Status
Not open for further replies.