Help with time counter

I need help to create a timer that resets when it dies, there is my script

= 0 counter = counter + (amount or 0)

" If there is a big mistake, sorry, I just started xD "

What are you exactly trying to do? I might help.

On when the player dies or when it reaches a certain amount?

When he dies

Sorry for the bad explanation

Anyway, I’m creating a game of “Survive”, which you escape from a NPC. I wanted an accountant to keep running to show how long the person is surviving and restart when they die.

Once the player respawns the timer will stop automatically, but if you’re doing something else then

local Counter = 0 

local Player = PLAYER
local Humanoid = Player.Character:WaitForChild("Humanoid")

while Humanoid.Health > 0 do
   Counter = Counter + 1
   wait(1)
end
3 Likes