Minecraft – Teleport Player From Void To Spawn

minecraft-commandsminecraft-java-edition

I'm working on a Sky PvP server using only command blocks! If a player dies to another player I want them to drop their items on death, but when they fall down from island, I want to keep their inventory. How can i do this using command blocks?

Best Answer

On a clock, run these commands in this order:

/execute @a ~ ~ ~ /effect @p[y=-100,dy=99] resistance 1 5
/execute @a ~ ~ ~ /tp @p[y=-100,dy=99] X Y Z

Replace X Y Z with where you want them to be teleported back up to. The first command just gives a short resistance effect to stop the player from dying of fall damage.