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

How do I create a countdown GUI?

I know how to make a gui count down. The problem is, every time you die the GUI resets. I need to make a timer for my group's fort, so all player's timers have to remain exactly the same, even after death.

for i = 100,1,-1 do
	wait(1)
	script.Parent.Text = tostring(i)
end

This makes the gui count down, but it still resets after death. Please help.

1 answer

✓ Accepted answer

Instead of controlling everyone's GUI from a single script, I like making everyone follow their own value, that way it's less laggy and less I have to worry about it.

-- Put a IntValue in Workspace, name it 'count'.

-- Put a script in ServerScriptService

local count = Workspace:WaitForChild("count")
for i = 100,0,-1 do 
	count.Value = i
	wait(1)
end

-- The script in the GUI

local label = script.Parent
local count = Workspace:WaitForChild("count")
count.Changed:connect(function()
	label.Text = count.Value
end)

1 comment

0

That's a good idea, thank you.

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