So i have a zombie game with rounds
When someone quits the game it bugs the round causing it to stop my repeat loop of zombie rounds than it never runs again freezing the timer and not running?
repeat wait() game.Players.PlayerRemoving:Connect(function(player) collectionservice:AddTag(player.Character, "Dead") end) for x, player in pairs(plrs) do if player then character = player.Character collectionservice:AddTag(player.Character, "Alive") if not character then -- left the game table.remove(plrs,x) player.ingame.Value = false collectionservice:AddTag(player.Character, "Dead") else if character:FindFirstChild("GameTag") then -- They are still alive print(player.Name.." is still in the game!") player.ingame.Value = true collectionservice:AddTag(player.Character, "Alive") else -- They are dead table.remove(plrs,x) player.ingame.Value = false collectionservice:AddTag(player.Character, "Dead") end end else table.remove(plrs,x) print(player.Name.." has been removed!") end end for i = GameLength,0,-1 do if gameInProgress.Value == false then Status.Value = "GAME OVER, Starting New Game" break end Status.Value = ""..i.." seconds ramaining, " if zombiesAlive.Value <= 5 then zombieCount.Value = 25 zombiesAlive.Value = 25 end wait() if #collectionservice:GetTagged("Alive") == 0 then name = player.Name check = game.Workspace:FindFirstChild(name) if check then checkHumanoid = check:findFirstChild("Humanoid") if checkHumanoid then for i, player in pairs(game.Players:GetPlayers()) do ingamez = player:FindFirstChild("ingamez") if ingamez then if ingamez.Value == false then -- Teleport them player.Character:MoveTo(AvailableSpawnPoints[i].Position) collectionservice:AddTag(player.Character, "Alive") player.ingamez.Value = true local equipped = game.ServerStorage.PlayerData[player.Name].Equipped until gameInProgress.Value == false and #collectionservice:GetTagged("Alive") == 0 wait() print("End of game") for i, player in pairs(game.Players:GetPlayers()) do character = player.Character player:LoadCharacter() if not character then -- ignore tehm else if character:FindFirstChild("GameTag") then character.GameTag:Destroy() end for _, tool in pairs(player.Backpack:GetChildren()) do if tool:FindFirstChild("Price") then tool:Destroy() end end for _, tool in pairs(character:GetChildren()) do if tool:FindFirstChild("Price") then tool:Destroy() end end end wait (2) player:LoadCharacter() end ClonedMap:Destroy() Status.Value = "Game Ended" wait(2)