Bhop timer

I can’t figure out how to get the timer to reset when the player dies.
This is the code for my hud:


local t1 = CurTime()

local function HUD()
local counter =  string.ToMinutesSeconds( CurTime() - t1 )
	draw.SimpleText( counter, "HUDFONT1", 500, 500, Color( 255, 255, 255) )
end
hook.Add( "HUDPaint", "HUD", HUD )

Send a message from server OnPlayerDeath to reset t1 to CurTime().

I figured that out, but I don’t know how I can do it

Bump

Heres a simple way of doing it, I would also use PlayerSpawn instead because there may be a delay between death and when the player is alive again.

Server
[lua]hook.Add(“PlayerDeath”, “Reset Time”, function(ply)
ply:SendLua(“t1 = CurTime()”)
end)[/lua]

EDIT: You can also use a net message or umsg to reset the time, i just chose SendLua because its the shortest way. Also I wouldn’t define the starting time on the client as the client can change the value if he wanted too so once he gets to the end of the map he just resets t1 to CurTime().

I added that to my PlayerSpawn function but it didn’t work, my time didn’t reset

Accidentally rated you dumb, but you can use a net or umsg to reset the time. I wasn’t sure if send lua would work in the first place.