I want to test if any player is on a certain block. I want to kill them if they are standing on that certain block.


1 Answer 1


execute's detect syntax is useful for this.

In 1.11 and below:

/execute @a ~ ~ ~ detect ~ ~-1 ~ sponge * /kill @a[c=1]

In 1.12 and above:

/execute @a ~ ~ ~ detect ~ ~-1 ~ sponge * /kill @s

This will kill anyone standing on sponge. The * is where you would put the block state, e.g for wool color=red or stone variant=granite.

You must log in to answer this question.

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