2

So I am building a minecraft parkour. In a certain level, people may not walk on the red wool. When they walk on it, they die.

Can someone help with the code on my command block ?

I have this right now :

/execute @a [XYZ] ~ ~ ~ detect ~ ~-1 ~ minecraft:wool 14 kill @p
Vemonus
  • 63,784
  • 66
  • 267
  • 403
Weeklyshark18
  • 43
  • 2
  • 8

1 Answers1

1
/execute @a[r=radius] ~ ~ ~ detect ~ ~-1 ~ minecraft:wool 14 kill @a[c=1]

This should work..

  • Put the command block in the center of that area and use a radius covering it, so people don't die where they shouldn't.

  • Use @a[c=1] instead of @p, because someone else walking by could die when there's still someone who died and hasn't respawned.

  • As proposed in the comments the selector @s can as well be used instead of @a[c=1] (assuming you're on 1.12). This will target the entity that is executing the command.

dly
  • 15,249
  • 8
  • 53
  • 81
  • 2
    assuming it's in 1.12 you should use @s instead if @a[c=1] anyways. also, using regional selectors is a thing and probably what they were trying to do: @a[x=X,y=Y,z=Z,dx=DX,dy=DY,dz=DZ] – Plagiatus Dec 20 '17 at 15:33
  • good point @Plagiatus – dly Dec 20 '17 at 16:46