I want to create armor stands whenever I stand on a certain block, but when I stand on it, it summons a lot of armor stands.

I tried /kill @e[type=ArmorStand,c=!1] to kill all except the newest one but it killed all of them.

What should I do to remove all except the youngest?

  • You have the selector [type=ArmorStand.c=!1], however it should be [type=ArmourStand,c=!1] (note comma instead of period), was this a mistake typing or did you also type it this way in the command? Also, I'm not sure if c=!1 works, I'll have to test it. – Shelvacu Feb 15 '15 at 11:15
  • 2
    MegaMoh, please don't use tags that are irrelevant to your question, it will get enough interest as it stands. – Robotnik Feb 15 '15 at 11:25
  • @shelvacu =! works – 54D Feb 15 '15 at 11:34
  • 4
    When restricting a selector with c=, it selects them in order of distance from the player, not age. – SirBenet Feb 15 '15 at 11:38
  • I made it in minecraft by the comma here I only mistaked and I tried ,c=!1 it does not work so I ask how – MegaMoh Feb 18 '15 at 10:37

Make a scoreboard

/scoreboard objectives add age dummy age

put a commandblock by a fill clock and type in

/execute @e[score_age=0,type=ArmorStand] ~ ~ ~ /scoreboard players add @e[type=ArmorStand] age 1

put another commandblock by a fill clock and type in

/kill @e[type=ArmorStand,score_age=2]
| improve this answer | |

Just kill all the armorstands before you summon a new one

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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