How can I use command blocks to detect a specific player within a certain radius of the command?

I can detect a specific player, or a player within a certain radius, but not both.

  • 1
    Hi Ethan, what's the command(s) you've got so far? If you show us your work, we'll be able to help figure out what's going wrong :) – Robotnik Jul 20 '15 at 4:05

You can specify multiple arguments by separating them with commas. Enter the following command into a command block:

/testfor @a[name=<name>,r=<radius>], where <name> is a player's username and <radius> is the circular distance around the block.

You could put this command block on an infinite redstone loop to make it run over and over, all the time.

  • 1
    And to just detect any player in the radius leave out the name and just have the radius. Example : /testfor @a[r=<radius>] and he explained this well enough for you to get the rhythm of it. – Eisler 485 Jul 21 '15 at 7:37
  • 1
    and to limit the number of players to detect use @p[c=<countMax>] – ydobonebi Jul 28 '15 at 5:08

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