2

I am trying to make a command block that when powered, it will looks for a specific player in a 5 block radius of the command block. I tried

/testfor @p[r=5][name=<name of player>]

but it doesn't work.

10

You can't use two [] next to each other.

/testfor @p[r=5,name=<PlayerName>]

Use a comma to separate different values. Don't add another [] next to it.

  • 1
    This does not work either. Did you find a solution? – Lawrence Thurman Dec 28 '14 at 19:50
  • Did not realize name is case Sensitive – Lawrence Thurman Dec 28 '14 at 20:04
  • can we test for name!=MyName ? – user97009 Dec 29 '14 at 21:44
  • @Sivmatt we can, but Minecraft uses name=!MyName for that, i.e. "name equals (not MyName)". Same for other fields such as type – MrLemon Feb 25 '15 at 12:26
  • Will this work if there is one player closer to the command block? It seems like using @a instead of @p is better. – Anders Lindén Jan 19 '17 at 18:49

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