0

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.

5

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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