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.

  • Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins! – Frank Feb 15 '16 at 20:53

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.

  • Just wondering what does the # corespond to? – TheVoidChaos Oct 8 '16 at 0:49
  • @TheVoidChaos The # makes it so that a) this cannot ever be a real player and b) the fake player will not show up on a scoreboard display. – MrLemon Oct 11 '16 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.