I am creating a round script for my game and I am stuck. I want to know how all players will return to the lobby after they are killed, but the round only restarts after one player is killed, and the time also freezes for other players that are still alive in the game/round. Why is this happening? I just want to get to the point of the script.
while true do wait(1) ftime = ftime - 1 text.Value = "Time: ".. ftime Playing = workspace.Players:GetChildren() if #Playing == 0 then for _, v in pairs(workspace.MapFolder:GetChildren()) do v:Destroy() end break end if ftime == 0 then for _, v in pairs(workspace.MapFolder:GetChildren()) do v:Destroy() end end for _, v in pairs(game.Players:GetChildren()) do if v.Character.Humanoid.Health == 0 then workspace.Players[v.Name]:Destroy() end end end
In the line between 23 and 24, you'll need to add a break. If you don't add it, the loop will stop working after one player reset and returns to the lobby. It's funny how I've answered my own question.