Hello!
I'm working on a game where I have two leaderstats, TimeAlive and TopTime. I already have the TimeAlive figured out, but I'm wondering how I can make the TopTime. Does anyone know how I can do this?
Hey, your problem can be solved simply by putting
TopTime.Value = tick()
this should work for time but I am not sure, I don't usually make time leaderstats.
Well i don't know how your architecture looks like so the answer might not be as like you needed but here is example of how to do it with simple variables:
local CurrentTime = 0 local MaxTime = 0 while true do wait(1) CurrentTime += 1 if CurrentTime > MaxTime then MaxTime = CurrentTime end end
Basically you should understand here, CurrentTime
is the current time and MaxTime
is your highest time. I have put while loop there so the time adds every second and at line 7 it checks if the current time is higher than your highscore time then it will set the MaxTime
to the CurrentTime
.