This question already has an answer here:

I'm trying to get whenever you hold an item (diamond sword) it will give you particles. I know how to do this but not when something has a custom name.

/scoreboard players set @a HoldSword 1 {SelectedItem:{id:"minecraft:diamond_sword"{display:{Name:"&4FadedSharp's Sword"}}

I don't know what is wrong with this code; can someone please help me?

marked as duplicate by Virusbomb, bearb001, Schism, dly, galacticninja Jul 9 at 7:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 7
    What're you trying to do and what is it not doing? – Vemonus Mar 21 '17 at 15:37
  • 1
    @rivermont-WillB. Please do not use quotations for commands, as they are not quotations. Use code blocks instead (4 spaces, as it was before your edit). – Skylinerw Mar 21 '17 at 23:51

Data that you specify in /give, such as {display:{Name:"&4FadedSharp's Sword"}}, is put into the item's tag tag. You can test for it like this:

/scoreboard players set @a HoldSword 1 {SelectedItem:{id:"minecraft:diamond_sword",tag:{display:{Name:"&4FadedSharp's Sword"}}}}
  • it would say unbalanced brackets pls help – FadedSharp Mar 22 '17 at 15:29
  • @FadedSharp The command he provided is syntactically correct and works. If you're changing the command, you need to provide the new command. – Skylinerw Mar 22 '17 at 18:22

you wrote the code for the name and forgot the "tag" before saying the name, the correct way of writing it is:

/scoreboard players set @a HoldSword 1 {SelectedItem:{id:minecraft:diamond_sword,tag:{display:{Name:"&4FadedSharp's Sword"}}}}

you must add a "tag" before the "{display:{Name:"SWORDS NAME"}"

  • it would say this: [21:14:39] The dataTag does not match for FadedSharp – FadedSharp Mar 23 '17 at 20:15
  • yes, because you didn't hold the diamond sword called "&4FadedSharp's Sword" you must be holding it to be activated – Mohannad El-Nesr Mar 24 '17 at 21:17
  • @FadedSharp did it work for you – Mohannad El-Nesr Mar 28 '17 at 16:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.