2

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]
    

1 Answer 1

2

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
  • thanks for the halp it was the coordinates that i had wrong i set it to ~ ~-1 ~ and now it wors
    – Alex
    Commented Jan 5, 2017 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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