I know there must be a way to do this, but how can you make it so that if a player is at a specfic y level, they instantly die?
15
How do I sense if a player said something in the chat?
I think the below would work:
How it works:
And that's it! Hope this helps!
/execute if entity @a[y=<Whatever Y-level>..] run kill @a[y=<Whatever Y-level>..]How it works:
/executeA command. More about it here.if entityCheck if the specified entities exist. For more information, see here.@a[y=<Whatever Y-level>..]Selects all players that are below y-level <Whatever Y-level>. The ".." means "and below". Replace <Whatever Y-level> with your Y-levelrunRun the following commandkill @a[y=<Whatever Y-level>..]Kills those players, if they exist. Again, replace <Whatever Y-level> with your desired y-level.And that's it! Hope this helps!
You actually don't need the execute commands. Most complex data packs are made of unnecessary execute commands. Also, the ".." should be before the <Y> if you want "or below". That would work:
kill @a[y=..<Y>]No need for execute.The x, y, z arguments don't support ranges. There is dx, dy, dz for that.
In case @a[y=<Y-Level>] doesn't work, try @a[y=<Y-Level,dy=0] or @a[y=<Y-Level>,dy=1]
You most likely want to add something like "gamemode=adventure" to that list to avoid killing yourself over and over again xD
In case @a[y=<Y-Level>] doesn't work, try @a[y=<Y-Level,dy=0] or @a[y=<Y-Level>,dy=1]
You most likely want to add something like "gamemode=adventure" to that list to avoid killing yourself over and over again xD
Ahh I wasn't sure if it supports ranges so I checked and discovered it doesn't, then wrote it does because I'm a genius.
Hahahahaha as Mark would say: "I'm a gunious!"
I have no idea who is Mark but sure.
View 1 more replies
Yeah, thank you for your help on both of my problems!
I had almost gotten to that soloution, but I didn't have the killing only happening for the player at the y level on the last part, so I kept on dying lol. Thanks! :)
I had almost gotten to that soloution, but I didn't have the killing only happening for the player at the y level on the last part, so I kept on dying lol. Thanks! :)
Or if they are on a specific block, such as on a diamond block.
Just in case, the way to do this is:
where "diamond_block" can be replaced with any block id
The code is pretty self explanatory, but basically it says "Have each player check the block right below them. If it is a diamond block, then run the kill command."
Note that because this checks the block RIGHT BELOW the player, they must actually be standing directly on it to die.
| /execute as @a at @s if block ~ ~-0.01 ~ minecraft:diamond_block run kill @s |
where "diamond_block" can be replaced with any block id
The code is pretty self explanatory, but basically it says "Have each player check the block right below them. If it is a diamond block, then run the kill command."
Note that because this checks the block RIGHT BELOW the player, they must actually be standing directly on it to die.
Okay, how should I configure the command block for this command, because it works if I run it from chat but I cant get it to work any other way.
Thanks!
Thanks!
It should work with repeat and always on. Sometimes minecraft doesn't recognize repeating commands right and you need to fiddle around with it and try again.
Ok, thank you, I will try that.
Okay, cool thanks ;)
