I'm working on a capture the flag minicame in Minecraft 1.8.1. One of the features is automatically picking up flags when a valid player is in range. To accomplish this, I placed an armor stand inside each flag.

The goal is to get that armor stand to test for valid players (i.e. not on the same team, doesn't already have a flag, etc.) and set the block that was the banner to air. Each flag has a certain rotation value that is used to tell what team it represents - in this case, a rotation (ry and rym in the command) of 0 means the blue team. So, this command should tell all armor stands with a rotation of 0 to check for players not on the blue team who don't already have a banner.

Here's the command that isn't working: execute @e[type=ArmorStand,ry=0,rym=0] ~ ~ ~ testfor @p[r=2,score_hasBanner=0,team=!blue]

And here's the error: Failed to execute '/testfor @p[r=2,score_hasBanner=0,team=!blue]' as Heads Up ("Heads Up" is the custom name of the armor stand, don't worry about why)

This error tells me that the execute command must be working fine, meaning it's a problem with the testfor command. However, using the testfor part on its own works perfectly.

Any ideas? Thanks in advance.

  • Is execute a valid command keyword? Have you added / at the beginning? All command require a / at the beginning, regardless if it's in the chat log or in a command block.
    – Ben
    Commented Dec 23, 2014 at 22:49
  • What error are you getting?
    – Ben
    Commented Dec 23, 2014 at 22:52
  • 1
    No, you don't need a slash in front of the commands in the command block - I haven't used a single one and the rest of the project works fine. execute is a valid command since 1.8, and I'm sure I've got the syntax right. Error is just a generic Failed to execute '/testfor @p[r=2,score_hasBanner=0,team=!blue]' as Heads Up
    – eritbh
    Commented Dec 23, 2014 at 23:00
  • I'll add that to the question
    – eritbh
    Commented Dec 23, 2014 at 23:01
  • Since the armor stand has a custom name, why aren't you using execute @e[name=<name>...?
    – MBraedley
    Commented Dec 27, 2014 at 3:09

2 Answers 2


The command itself is completely fine, and works for me:

enter image description here

Make sure:

  • You are within range of the ArmorStand that is actually executing the command. If you have multiple ArmorStands with 0 rotation (likely, as they spawn like that by default) the output will only show the result of the ArmorStand that happens to execute last, which may not be in range.
  • You actually have a hasBanner score of 0. The default score for an objective is unassigned, not 0, so make sure it's being set to 0 somewhere.
  • You are not on blue team.
  • Woah, sorry I didn't see this! That's 2 people that say it's operator error, then. I'm away from my worlds right now, but I'll look over your suggestions ASAP. Thanks.
    – eritbh
    Commented Mar 10, 2015 at 19:33

This is natural behavior if nothing was found. According to this wiki page, the testfor command fails if no entities match the selector. It appears that your command block is working properly.

  • This doesn't answer my question - if my command is working properly, then why isn't it doing what I wrote the command for? What do I need to change in order to accomplish the task at hand?
    – eritbh
    Commented Dec 28, 2014 at 6:35
  • That's just how it works for some reason. It says it failed to execute the command, but what it means is that the command failed to find anything. The last time the command was run, was there anything it should have found? Commented Dec 28, 2014 at 13:36
  • Yeah. Like I said in the question, it was supposed to find me -The armor stand had the correct rotation, 0, I wasn't on the blue team, I had a hasBanner score of 0, and I was within 2 blocks of the armor stand. The question isn't why is this specific error coming up, it's why is there an error at all, if everything was set up according to the command?
    – eritbh
    Commented Dec 28, 2014 at 23:11
  • @GeorgePlatko also it might make it easier to put the armor stands on the relevant teams instead of using rotations. Commented Dec 29, 2014 at 2:42
  • ...I can't believe I dodn't think of that. You're toally right. Still, I wonder why this one doesn't work.
    – eritbh
    Commented Dec 29, 2014 at 3:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .