How to add a check to this script? Please help!
So I am trying to make a mini game game, however I have no clue on how to add a check to see if all players have died, can someone help me?
So here is the script.
02 | local select = script.Rounds:GetChildren() |
03 | local h = script:WaitForChild( "Status" ) |
05 | if game.Players.NumPlayers > = 1 then |
08 | h.Value = "Choosing gamemode!" |
09 | local roundchosen = math.random( 1 , # select ) |
11 | local round = select [ roundchosen ] |
12 | print ( "Chosen round: " .. round.Name) |
14 | if round.Name = = "FFA" then |
16 | elseif round.Name = = "DODGEMS" then |
18 | elseif round.Name = = "SFFA" then |
19 | h.Value = "Gamemode chosen: " .. round.Name |
24 | h.Value = "Waiting for 2 players too start!" |
31 | local maps = game.Lighting.Maps.FFA:GetChildren() |
32 | h.Value = "Choosing map.." |
34 | print ( "Map selection" ) |
35 | local mapchosen = math.random( 1 , #maps) |
36 | local map = maps [ mapchosen ] |
39 | local mapclone = map:Clone() |
40 | mapclone.Parent = game.Workspace |
43 | for _, player in pairs (game.Players:GetPlayers()) do |
44 | local contestants = { } |
45 | table.insert(contestants, player) |
46 | local spawnmodel = map.Spawns:GetChildren() |
47 | local spawn = math.random( 1 , #spawnmodel) |
48 | local spawnchosen = spawnmodel [ spawn ] |
49 | player.Character.Torso.CFrame = CFrame.new(spawnchosen.Position + Vector 3. new( 0 , 3 , 0 )) |
53 | h.Value = "Time left: " .. i |