Hi guys! This loop is part of an Elimination round for a Murder Game. I tested on studio, the first "if" works, but when there's only 1 player in the "Playing" team, the "elseif" section should kick in but it doesn't. It seems like I went wrong somewhere. There are no output errors. Please help.
THE CODE IS SOMEWHERE BETWEEN 50 and 60 LINES LONG
while wait() do
players = game.Players:GetPlayers()
if game.Workspace.Time.Value == 0 or game.Players.NumPlayers <2 then
workspace.Ingame.Value = false
workspace.Elimination.Value = false
for i=1,#players do
if game.Players:FindFirstChild(players[i]) then
items = players[i].Backpack:GetChildren()
for b = 1,#items do
if items[b]:IsA("Tool") then
items[b]:Destroy()
end
end
tools = players[i].StarterGear:GetChildren()
for v=1,#tools do
tools[v]:Destroy()
end
players[i].TeamColor = game.Teams["Not Playing"].TeamColor
wait(0.5)
players[i]:LoadCharacter()
end
end
game.Workspace:FindFirstChild("Map"):Destroy()
game.Workspace.Lobby.Noti.SurfaceGui.TextLabel.Round.Text = ""
game.Workspace.Lobby.Noti.SurfaceGui.TextLabel.Map.Text = ""
break
elseif game.Teams.Playing:GetChildren() == 1 then
winner = game.Teams.Playing[1].Name
workspace.Ingame.Value = false
workspace.Elimination.Value = false
game.Workspace.Time.Value = 0
for i=1,#players do
if game.Players:FindFirstChild(players[i]) then
items = players[i].Backpack:GetChildren()
for b = 1,#items do
if items[b]:IsA("Tool") then
items[b]:Destroy()
end
end
tools = players[i].StarterGear:GetChildren()
for v=1,#tools do
tools[v]:Destroy()
end
players[i].TeamColor = game.Teams["Not Playing"].TeamColor
wait(0.5)
players[i]:LoadCharacter()
end
end
game.Workspace:FindFirstChild("Map"):Destroy()
game.Workspace.Lobby.Noti.SurfaceGui.TextLabel.Round.Text = ""
game.Workspace.Lobby.Noti.SurfaceGui.TextLabel.Map.Text = ""
break
end
end

1 comment
I really like your answer, but someone has already answered on the community chat. Thanks for the help!