How do I change this script so that all players die at the same time, and the clock doesn't reset after One person dies?
local time = 2500 for i = 1, 2500 do wait(1) time = time - 1 script.Parent.Text = tostring(time) end script.Parent.Text = "game over" script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
Put this in a Script inside Workspace.
local players = {} -- table for players local time = 2500 for i = 1,2500 do wait(1) time = time - 1 end game.Players.PlayerAdded:connect(function(p) -- when a player is added local gui = p.PlayerGui:WaitForChild("GuiName") -- finds the gui if gui then local text = gui.TextLabel -- finds the TextLabel if text then p.CharacterAdded:connect(function(char) -- when their character is added local human = char:WaitForChild("Humanoid") -- finds the humanoid human.Died:connect(function() -- when a player dies text.Text = "Game Over" -- changes text end) end) players:insert(p) -- puts the player in the table end end end) game.Players.PlayerRemoving:connect(function(p) table.remove(players,p) -- removes player from table, to avoid nil values end while true do -- repeats forever, can only have one infinite While loop in a script, only put these at the bottom of a script for _,v in pairs (players) do -- does this for every player local find = v.PlayerGui:FindFirstChild("GuiName") if find then local text = find.TextLabel if text then text.Text = tostring(time) -- changes text to time end end end wait() end