I'm trying to set up a trap for my friend on my server, I want to use command blocks, not tripwire.

I know the /testfor command, but it always says that it found me and doesn't give another output.

2 Answers 2


You can do this with the execute command.

  1. Setup a full clock. I recommend the answer to this question if you need to know how.
  2. On one side of that red stone block, put down a new command block with this command in it:

Execute Notch ~ ~ ~ detect ~ ~-1 ~ grass 0 <command>

Replace notch with your friend's name, replace grass with the block name you want him to be standing on, and replace command with the command you want to do.

  • What do I do with the cords, just put them in? Or do they have to have the tildas? Aug 21, 2015 at 19:26
  • @PeoplePerson Tildes need to be there, as it's executing at his exact position (the tilde will represent his exact coordinate) to detect the block under him.
    – Judge2020
    Aug 21, 2015 at 19:29
  • If you want the trap to catch any player, replace Notch with @a. Note that this will execute the command at any player standing on the block, so using a common block like grass is likely to cause problems.
    – user109232
    Aug 22, 2015 at 12:07

For get an output, you have to put a comparator in front of the command block. When it finds you, the comparator should emit a redstone pulse that will activate whatever you want.

  • This does not answer the question. He had the problem of the command block finding him and not his friend
    – Judge2020
    Aug 26, 2015 at 9:38

You must log in to answer this question.

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