Minecraft – Why isn’t this command working with armorstands

minecraft-commandsminecraft-java-edition

I made 2 custom mobs, a Fairy, and a Ghost, both using armor stands as a base. After the command block creates them it assigns them a scoreboard of either Fairy or Ghost. I understand why it doesn't work, but I don't know how to fix it. I have indicated the commands below:

Ghost:

/summon ArmorStand ~ ~4 ~-4 {NoBasePlate:1,ShowArms:1,CustomName:Ghost,Riding:{id:"Bat",ActiveEffects:[{Id:14,Amplifier:1,Duration:1000000,Ambient:1}]},Equipment:[{},{id:305},{id:305},{id:305},{id:305}]}

/scoreboard players set @e[type=ArmorStand] Ghost 1

Fairy:

/summon ArmorStand ~ ~4 ~-4 {CustomName:Fairy,Invisible:1,Riding:{id:"Bat",ActiveEffects:[{Id:14,Amplifier:1,Duration:1000000,Ambient:1}]}}

/scoreboard players set @e[type=ArmorStand] Fairy 1

Best Answer

The command /scoreboard players set @e[type=ArmorStand] Fairy 1 just sets all of the armor stands in the world to 1 on objective Fairy. In the command, you should make it so that it would also track the entity's name. The command looks something like this:

/scoreboard players set @e[type=ArmorStand,name=Ghost] Ghost 1

Keep in mind, I put "Ghost" in the command, thinking that "Ghost" is the objective you have set (the "Ghost" I'm talking about is the one that comes right before the "1".). Also, after you add the armor stands to a scoreboard, type /scoreboard objectives setdisplay sidebar Ghost as debug (or "Fairy" for the "Fairy" objective). The names of the stands will be a bunch of letters and numbers (the unique identifier for each of the ArmorStands included in the objective, e.g. "bd767be3-c762-4fc9-b703-4e883c4a959c").

When you don't need the debug scoreboard anymore you can type /scoreboard objectives setdisplay sidebar to remove it from your screen.

Related Topic