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

How do you make timer continue after death?

I'm using a timer to see if anyone can finish in 2 minutes for my obby game but when ever we die then the timer restarts. Can anyone help me I want the timer to continue. The script is

script.Parent.Parent.Play.MouseButton1Click:Connect(function()
	local seconds = script.Parent.Parent.Time

script.Parent.Text = seconds.Value

for i = 1,seconds.Value do
 wait(1)
 seconds.Value = seconds.Value - 1
 script.Parent.Text = seconds.Value
end

if script.Parent.Text == "0" then
	script.Parent.Sound:Play()
  end
end)

Btw I'm new to lua.

2 comments

0

Don't forget to accept my answer if it helps.

0

Thank you so much incapaxx! It did work but I don't know how to accept your answer.

1 answer

✓ Accepted answer

This doesn't require any scripting at all.

What you must do is go to the ScreenGui, and untick the ResetOnSpawn property. This property determines if a new instance of the GUI should be given on respawn.

When you spawn, the contents of StarterGui are cloned into your player's PlayerGui. It's a different GUI you are seeing each time you reset.

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