Minecraft – Fill blocks when someone dies in minecraft

minecraft-bedrock-editionminecraft-commands

So, I am playing with my friend. For a few days, we have been working in a PVP arena. I also decided that I would use commands to do so. I would have a wall to separate the two players and when they click the start button, it removes the wall. So, I want to replace the wall when someone dies so the other person doesn't get unfair hits before the other person is ready. Please help!

Best Answer

You Need To Know

How chain command blocks work.

What

At spawn, have a pressure plate. Have each team tagged so we can identify them! I will use tags “blue” and “red”. When this pressure plate is pressed, have it run the commands:

/fill 7 2 0 7 10 10 brick

Make a brick wall from 7, 2, 9 to 7, 10, 10. Now an always active chain:

/tp @p[r=10,tag=red] 4 5 5

If red died, teleport them to where they need to go (I used 4, 5, 5). Do nothing if a blue player. Then another always active chain:

/tp @p[r=10,tag=blue] 10 5 5

Do the same for blue, let’s say blue needs to go to 10, 5, 5. Then, this is optional, but another always active chain:

/to @p[r=10] 30 20 25

If somehow someone without an assigned team spawns, let’s put them at 30, 20, 25. This could be a spectator area, lobby, etc.