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.

nbt of player's tool

Discussion in 'Skript' started by Itqly_, Dec 10, 2018.

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

    Itqly_ Member

    Joined:
    Sep 20, 2018
    Messages:
    29
    Likes Received:
    1
    Hey SkUnity community: i was creating a skript to make Tools unbreakable with a command but I encountered a problem: I don't know how to add nbt tags.

    I tried with:
    Code (Skript):
    1. add "{Unbeaking:1}" to nbt of player's tool
    but it gives me an error.

    My current addons are:
    SkQuery
    SkRayFall
    WildSkript

    Thanks in advance for your help
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    I recommend using the HELP REQUEST FORMAT because you are missing a lot of details in this post here.
     
  3. Itqly_

    Itqly_ Member

    Joined:
    Sep 20, 2018
    Messages:
    29
    Likes Received:
    1
    Ok sorry:

    Skript version: 2.2
    Skript author: Bensku
    Minecraft Version: 1.8 (spigot)

    Code:
    Code (Skript):
    1. on right click with diamond pickaxe on player:
    2.     if player is holding diamond pickaxe named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword":
    3.         cancel event
    4.         set {slot.%player%} to selected hotbar slot of player
    5.         set slot {slot.%player%} of player to diamond sword of sharpness 3 and unbreaking 1 named "&9&lSword" with lore "||&7Right click on a Block||&7to transform this tool||&7into a &9&lPickaxe"
    6.         add "{Unbeaking:1}" to nbt of player's tool
    7. on right click with diamond sword:
    8.     if clicked block is set:
    9.         if player is holding diamond sword named "&9&lSword" with lore "||&7Right click on a Block||&7to transform this tool||&7into a &9&lPickaxe":
    10.             cancel event
    11.             set {slot.%player%} to selected hotbar slot of player
    12.             set slot {slot.%player%} of player to diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"
    13.             add "{Unbeaking:1}" to nbt of player's tool
    14. command /Pick [<player>]:
    15.     permission: command.pick
    16.     trigger:
    17.         if arg 1 is not set:
    18.             give player diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"
    19.         else:
    20.             give arg 1 diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"
    21. on first join:
    22.     give player diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"
    Error:
    Code (Skript):
    1. 'player' is not an item stack (Tool.sk, line 6: add "{Unbreaking:1}" to nbt of player's tool')
    2. 'player' is not an item stack (Tool.sk, line 13: add "{Unbreaking:1}" to nbt of player's tool')
    --- Double Post Merged, Dec 11, 2018, Original Post Date: Dec 11, 2018 ---
    I tried removing the 'add "{Unbeaking:1}" to nbt of player's tool' and it workes perfectly ! So i suppose thats the problem
     
  4. Andalmere

    Andalmere Active Member

    Joined:
    Jan 28, 2017
    Messages:
    63
    Likes Received:
    11
    it's unbreaking not unbeaking
     
  5. Itqly_

    Itqly_ Member

    Joined:
    Sep 20, 2018
    Messages:
    29
    Likes Received:
    1
    That is not the problem ! Even if it was wrong that was a minecraft problem and not skript !
    anyways i fixed and still gave me error
     
  6. Noblesuntzu

    Noblesuntzu Active Member

    Joined:
    Feb 18, 2017
    Messages:
    63
    Likes Received:
    4
    You could also just do
    Code (Skript):
    1. set tool of player to unbreakable (tool of player)
    I'm pretty sure.
     
  7. Itqly_

    Itqly_ Member

    Joined:
    Sep 20, 2018
    Messages:
    29
    Likes Received:
    1
    Still not working:

    error:
    Code (Skript):
    1. 'unbreakable' is not an entity type
     
Thread Status:
Not open for further replies.

Share This Page

Loading...