Hi,
I was wondering how to make a tick clock because I want to count time locally not based on server lag or anything. I don't know how to count in tick so basically I want to make a stopwatch which ends at the players death and starts basically at the time I want it to. I also want the time to go onto a gui and be in a colon format like (3(m):05(s):04(ms).
Would it look something like this? (This wont work)
local startTime = tick() while wait(1) do -- This wont work because there is still a wait inside which doesnt count globally. currentTimeAmount = tick() textLabel.Text = currentTimeAmount -- I know this is wrong because i didnt declare a variable but i need -- to be quick end -- I'm stuck on rounding and formatting the timer in the way I want it to be. -- I'm also stuck on stopping at death but I know the event to use is humanoid.Died.
Thanks
You can try something like this
local i = 0; local unbreak = true; yourPlayer.Humanoid.Died:connect(function() unbreak = false; end); while unbreak do i = i+wait(1); timer.Text = string.format("%.1d:%.2d:%.2d", i/3600, (i/60)%60, i%60); end;
You'll need to declare timer
and yourPlayer
, and you'll need to make this code run when you need it to.