How to test for people standing on a specific block?

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.
Best Answer
You can do this with the execute
command.
- Setup a full clock. I recommend the answer to this question if you need to know how.
- 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.
Pictures about "How to test for people standing on a specific block?"



How do you test a player in Minecraft in a certain area?
2. Type the CommandHow can you tell if a player is on a block in Minecraft?
Type in \u201c/co inspect\u201d to start the inspector. Then, use the following commands to track who placed or removed blocks on your server: Left-click a block to see which player placed it. Right-click a block to see when an adjacent block was removed.How to detect if player are standing on *SPECIFIC BLOCKS* in minecraft bedrock
More answers regarding how to test for people standing on a specific block?
Answer 2
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.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Artem Podrez, Andy Barbour, Andy Barbour, Andy Barbour