0

I'm trying to set the score 'ToxicJungleSafe' to 0 if a player isn't wearing a helmet in 1.12.2.

So far I have tried using ArmorItems tag, as well as Inventory tag. minecraft:air doesn't seem to work either.

0

[1.12-]

Repeat this:

/scoreboard players set @a ToxicJungleSafe 0
/scoreboard players set @a[nbt={Inventory:[{Slot:103b}]}] ToxicJungleSafe 1

[1.13+]

1.13 syntax makes this easier, and condenses it into one command.

This command will give players a score of 1 if the player has an item in their 103rd inventory slot, which is the armor slot for the head.

execute as @a store result score @s ToxicJungleSafe if entity @s[nbt={Inventory:[{Slot:103b}]}]

If you want the player to need all 4 armor pieces equipped in order to be 'safe', just add the other slots:

execute as @a store result score @s ToxicJungleSafe if entity @s[nbt={Inventory:[{Slot:100b},{Slot:101b},{Slot:102b},{Slot:103b}]}]
| improve this answer | |
  • You can also just use /execute unless data in 1.13+ and don't need a score at all, you can just execute the command from there. – Fabian Röling Apr 5 at 16:55

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