Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make timer continue after death?

Asked by 5 years ago
Edited 5 years ago

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.

0
Don't forget to accept my answer if it helps. User#24403 69 — 5y
0
Thank you so much incapaxx! It did work but I don't know how to accept your answer. HasansWorld12 2 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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.

Ad

Answer this question