Minecraft – Detect if armourstand have nothing on head

minecraft-commandsminecraft-java-edition

Detect if armourstand have nothing on head?
i am making map where peaople can place armourstand into armourstand and i want to repair it with peaople grab the head and then they can grab it from another on one block but firt i need to kill armourstand without the head i am using java edition 1.16.5

Best Answer

I'm not sure exactly what you want, but this might solve your issue. You can test if the armor stand does not have a player head:

execute if entity @e[type=armor_stand,nbt=!{ArmorItems:[{id:"minecraft:player_head"}]},sort=nearest,limit=1]