local minutes = 5 -- What the timer starts from local seconds = 00 -- What the timer starts from local min = minutes local sec = seconds function killPlayers() local a = game.Players:GetChildren() for _,v in pairs (a) do v.Character:BreakJoints() -- Kills the player end end while true do wait(1) sec = sec - 1 if sec == 0 then min = min - 1 if min == 0 then killPlayers() min = minutes sec = seconds else sec = 59 end end local count = min.. ":" ..sec Gui.Text = count end
I previously received help with this script, to act as a countdown for when all humanoids die. Do I need to make a GUI for this, with another script? Can someone help me figure out my problem?
I previously answered, but I guess I didn't explain it properly:
You need to create a Gui, just put in StarterGui. Then you make a variable for it, E.G:
local gui = player.PlayerGui.ScreenGui -- player is undefined as of yet (this is an example)
We need to make it so that it does it on every player's screen, so:
while true do wait(1) sec = sec - 1 if sec == 0 then min = min - 1 if min == 0 then KillPlayers() min = minutes -- reset the timer sec = seconds else sec = 59 end end local count = min.. ":" ..sec.. " until players die." local a = game.Players:GetChildren() for _,v in pairs(a) do -- loop that gets all of the players and changes the text local gui = v.PlayerGui:FindFirstChild("ScreenGui") if gui then gui.TextLabel.Text = count end end end