As you can see it's a simple script, just using for loops to act as timers and changing the values I made when it ends. Like I said in the title the timer resets to intermission 30 seconds when I die in the game. Is there a way to make it keep counting down/be the same for everyone?

while wait() do
	
	
	--Won't start until these load
	local seconds1 = script.Parent:WaitForChild("Seconds")
	local prefix1 = script.Parent:WaitForChild("Prefix")


	--Default text and variables
	local label = script.Parent.ScreenGui.TextLabel
	local seconds = seconds1.Value
	local prefix = prefix1.Value

	--Changing variables
	seconds = 31
	prefix = "Intermission"
	
	
	--Round/Intermission loop
	for i = 1,seconds do
		wait(1)
		seconds = seconds - 1
		label.Text = prefix.." "..seconds
	end
	
	
	--Changing variables
	seconds = 11
	prefix = "Get Ready"
	
	
	--Round/Intermission loop
	for i = 1,seconds do
		wait(1)
		seconds = seconds - 1
		label.Text = prefix.." "..seconds
	end	
	
	
	--Changing variables
	seconds = 61
	prefix = "Game"
	
	
	--Round/Intermission loop
	for i = 1,seconds do
		if _G.DeadPeople >= game.Players.NumPlayers then
			seconds = ""
			prefix = "Game Over!"
			wait(4)
		elseif _G.DeadPeople < game.Players.NumPlayers then
			wait(1)
			seconds = seconds - 1
			label.Text = prefix.." "..seconds			
		end


	end
	
	
end

I tried to make the script as neat as possible for you. I appreciate any help!

7 comments

0

Is this a local script or a server script? If it's a local script, then I'm pretty sure it would reset on death.

0

It's a server script

0

Try using "repeat wait() until" and if statements so that when you die, the script will ignore everything until a certain quota is met.

0

could i just repeat wait() until never?

0

Yeah, but it wouldn't do anything below that line of code, until that thing is met.

0

If you're testing by yourself and you die wouldn't the counter stop because _G.DeadPeople == game.Players.NumPlayers?

0

It hasn't gotten to that yet. If I die during the intermission then it shouldn't do that..