Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to wait until only one person is on a team?

Asked by 10 years ago

So, I have a map changing script, and it currently just wait for 30 seconds and then teleports everyone back. How can I make it wait until only one person is on the team "In the Blitz" and then teleport everyone? Here is one of the if statements in my script.

if num==1 then--There are 18 other if statements  :/
  m.Parent = game.Workspace 
  m.Text = "Choosing Map..."
  wait(3)
  m.Text = "Map is 'The Classic Map', made by Anth4598"
  wait(3)
  m.Text = "This was the first map ever made for Blitz"
  wait(3)
  m.Text = "The Blitz will keep going until only 1 person remains.(goes for 30 seconds in beta)"
  wait(3)
  m.Text = "The weapon chosen is a sword."
  m.Parent = nil
  game.Lighting.Map1:clone().Parent = game.Workspace  
  for i = 1, # players do
   players[i].Character:MoveTo(Vector3.new(-7, 9.8, -4))
   game.Lighting.LinkedSword:clone().Parent = players[i].Backpack 
  end
  wait(30) --Here is where I need it to wait until there is one player on the team "In the Blitz"
    players[i].Character:MoveTo(Vector3.new(-169, 5.6, 27))
  game.Workspace.Map1:Remove() 
  m.Parent = game.Workspace
  m.Text = "Blitz over!"
  wait(3)
  m.Text = "You have 1 minute until the start of the next Blitz."
  wait(3)
  m.Parent = nil
    m:remove()
0
What do you mean by "on"? Do you mean, "alive" or just set to the particular team? BlueTaslem 18071 — 10y
0
This doesn't have many arguments to perform what you want, try using some conditional statements. Tesouro 407 — 10y

1 answer

Log in to vote
0
Answered by 9 years ago

u can use

local players = game.Players:GetChildren()
reapeat wait() until #players == 1

and u can put this too to announce the winner player

m.Text = players
Ad

Answer this question