I'm trying to give a score to a player if they have a certain item in their inventory
/scoreboard players set @a holdemeraldore {Inventory:[{id:minecraft:emerald_ore}]}
However when I try it I get the phrase "The Data Tag foes not match for (me)"
It does work if I use a selecteditem tag, but not an inventory tag
1
The syntax in 1.12 and below is
You also need to quote the ID in the recent versions.
But all this aside, I would not use scores for this, but tags:
These 2 commands will make sure only players who have emerald ore get the tag.
You can then check for these tags with
/scoreboard players set <targets> <objective> <score> <dataTag>You're not specifying a score in your command.You also need to quote the ID in the recent versions.
But all this aside, I would not use scores for this, but tags:
1.) /scoreboard players tag @a remove holdemeraldore
2.) /scoreboard players tag @a add holdemeraldore {Inventory:[{id:"minecraft:emerald_ore"}]}
These 2 commands will make sure only players who have emerald ore get the tag.
You can then check for these tags with
@a[tag=holdemeraldore]
