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.

How to use an event if someone is holding a particular item?

Discussion in 'Skript' started by thecodingninja, Oct 14, 2021.

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

    thecodingninja New Member

    Joined:
    Oct 10, 2021
    Messages:
    9
    Likes Received:
    0
    I am trying to make a sword that gives you absorbtion if you hold it but I don't know how I tries using on player's held item change, but that only works when you held the sword previously before swapping. Any Ideasa how to do this?
    Code (Text):
    1. on player's held item change:
    2.     if player is not holding an iron sword named "<purple>Protector Worlds" with nbt "{Unbreakable:1,AttributeModifiers:[{AttributeName:""generic.attack_damage"",Amount:17,Slot:mainhand,Name:""generic.attack_damage"",UUID:[I;-121912,29295,214724,-58590]}],HideFlags:6}":
    3.         remove absorption from player
    4.     if player is holding an iron sword named "<purple>Protector Worlds" with nbt "{Unbreakable:1,AttributeModifiers:[{AttributeName:""generic.attack_damage"",Amount:17,Slot:mainhand,Name:""generic.attack_damage"",UUID:[I;-121912,29295,214724,-58590]}],HideFlags:6}":
    5.         apply absorption to player for 100000 seconds
     
  2. Mr_Allawi_

    Mr_Allawi_ Member

    Joined:
    Sep 20, 2021
    Messages:
    12
    Likes Received:
    0
    ya know just thing about stuff carefully

    Code (Text):
    1. if player is holding an iron sword named "<purple>Protector Worlds" with nbt "{Unbreakable:1,AttributeModifiers:[{AttributeName:""generic.attack_damage"",Amount:17,Slot:mainhand,Name:""generic.attack_damage"",UUID:[I;-121912,29295,214724,-58590]}],HideFlags:6}":
    2.         apply absorption to player for 100000 seconds
     
  3. thecodingninja

    thecodingninja New Member

    Joined:
    Oct 10, 2021
    Messages:
    9
    Likes Received:
    0
    It gives an error:can't understand this event: 'if player is not holding an iron sword named "<purple>Protector Worlds" with nbt "{Unbreakable:1,AttributeModifiers:[{AttributeName:""generic.attack_damage"",Amount:17,Slot:mainhand,Name:""generic.attack_damage"",UUID:[I;-121912,29295,214724,-58590]}],HideFlags:6}"'
     
  4. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    You need SkBee
     
Thread Status:
Not open for further replies.

Share This Page

Loading...