Glam Prestige Journal

Bright entertainment trends with youth appeal.

I am making a map and I need to kill any player that steps on an iron block, but the commands aren't working. Here are the commands:

  • Prequisites:

    /scoreboard objectives add IRONDEATH dummy
    /scoreboard objectives setdisplay sidebar IRONDEATH
  • Repeat always active command blocks:

    /scoreboard players set @a IRONDEATH 0
  • Chain always active command blocks:

    /execute @a ~ ~ ~ detect ~ ~1 ~ iron_block 0 /scoreboard players set @a[c=1,r=1] IRONDEATH 1
    /execute @a[score_IRONDEATH_min=1] ~ ~ ~ /kill @a[score_IRONDEATH_min=1]

2 Answers

The error is with your detect coordinates. ~ ~1 ~ means 1 block above the player's position, rather than 1 block below which would be ~ ~-1 ~.

If you don't need to do anything else with the IRONDEATH score, you could also simplify this down to:

execute @a ~ ~ ~ detect ~ ~-1 ~ iron_block 0 /kill @a[c=1]
1

You can use this command:

/execute @a ~ ~ ~ detect ~ ~-1 ~ iron_block 0 kill @p[c=1]
3