Minecraft – I’m trying to /testfor a player on a block

minecraft-commandsminecraft-java-edition

I am trying to make a command block that when a player walks over a block, it will detect the player and activate another command block with a different command. I tried:

/testfor @p {coordinates of the block}

but this doesn't work.

Best Answer

According to this page from the Minecraft wiki, you also need to specify a radius within the block to check for the player.

To count the number of players in survival mode within a 3-block radius of (0,64,0):

testfor @a[0,64,0,r=3,m=0]

(The r= isn't strictly necessary, but it makes the command a little clearer.)