Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Timer that kills people after 300 seconds?

I currently have a timer that counts down from 300 seconds. Is there anyway that after the timer gets to 0, it kills all players?

Code:

while true do
 for i = 300,0,-1 do
 wait(1)
 script.Parent.Text = "Countdown: "..i 
 end
end

2 answers

while true do
	for i = 300,0,-1 do
		wait(1)
		for _,p in pairs(game.Players:GetPlayers()) do
			p.PlayerGui.ScreenGui.TextLabel.Text = "Countdown:"..i.." seconds left"
		end
		if i == 0 then
			for _,p in pairs(game.Players:GetPlayers()) do
				p.Character.Humanoid.Health = 0
			end
		end
	end
end

local Seconds = 0

while true do
	for i = 300,0,-1 do
		wait(1)
		script.Parent.Text = "Countdown: "..i 
		Seconds = i

		if Seconds == 300 then 
			for _, v in pairs(game.Players:GetChildren()) do 
				v.Character:BreakJoints()
			end
		end
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.