How to make so when all players except for one die, everyone gets teleported by command block
How do I make it so when all but one person reaches 0 lives everyone gets teleported to my spawn area? There can be any amount of players.
Best Answer
You can set up a counter for players with at least 1 life left using /execute. I'm using your existing lives objective here.
In 1.8, this is arguably best done using an armor stand to hold the score:
/summon ArmorStand ~ ~ ~ {CustomName:"playersLeft",Marker:1b,Invisible:1b}
Now, create a clock and run:
/scoreboard players set @e[type=ArmorStand,name=playersLeft] lives 0
/execute @a[score_lives_min=1] ~ ~ ~ scoreboard players add @e[type=ArmorStand,name=playersLeft] lives 1
/execute @e[type=ArmorStand,name=playersLeft,score_lives=1] ~ ~ ~ <your command>
What happens is that the armor stand's score is set to 0, and then incremented by 1 for every player that has at least 1 life left. Your command is then run when the armor stand's score is (at most) 1.
In 1.9, you can use the magic of conditional command blocks to skip the armor stand and use a fake player instead. Set up a repeat/chain line and run:
/scoreboard players set #playersLeft lives 0
/execute @a[score_lives_min=1] ~ ~ ~ scoreboard players add #playersLeft lives 1
/scoreboard players test #playersLeft lives 1 1
Then, place your command in a conditional chain command block at the end of this line.
Pictures about "How to make so when all players except for one die, everyone gets teleported by command block"



How do you give someone a command block with multiple players?
Give Multiples of Item If want to give multiple blocks at once, you need to specify an Amount in the /give command. The amount goes after the Item that you are giving. Type the command in the chat window and press the Enter key to run the command. In this example, you have specified an amount of 4 in the /give command.How do you teleport all players using command blocks?
Type this command in when having the command block GUI open /teleport @p <x> <y> <z> . Then, activate the command block with redstone (including buttons, levers, and pressure plates), and they will be sent to their destination. The player can set up multiple different teleports.How do you stop a command block from teleporting?
If the command block is not at the spawn; type /kill . But if one is at spawn just look down real quick and break it if you can.Can other players see the give command?
Only operators can see command output from players. However, the /give and /gamerule commands you did will still be visible in chat. Show activity on this post. Using this command nobody should be able to see what commands were used. The effect starts imidiately, so nobody will see that you used this command.3 Deadly Command Blocks (Minecraft PE)
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Jim De Ramos, Kaique Rocha, Magda Ehlers, Magda Ehlers
