Best way to get accurate speed-run times?

I have an obby and want to have a speed-run timer. Right now I am setting a variable to the current tick() when the player starts then subtracting the starting tick() from the current tick() when the player starts. This seemed to work very well, however, this showed to be inaccurate as many people consistently got the same time:
image
image

At the moment I am looking for alterative ways of doing this, but I am open to other solutions. But do remember that it’s important that this system can get an accurate time down to the millisecond (just the hundredths place as seen in the pictures)

2 Likes

I always use workspace.DistributedGameTime, but I think it’s probably the same idea as tick() (maybe I’m wrong, idk).

1 Like

external speedrun timers should be better considering there will be no lagging on client nor the server

1 Like

Another way I could think of doing this is with RunService and adding the DeltaTime to a variable

so like:

local Time = 0

local Connection = RunService.Heartbeat:Connect(function(dt)
Time += dt
end)

– when their finished the run Disconnect the Connection, but idk if this is anymore accurate

1 Like

Try using os.clock() instead

This counts in seconds, so there’s no solid way of getting milliseconds (I think this might of been the reason why my current system sucks)

It’s not like the number 1 person on each of the leaderboards wins $10,000, so it doesn’t need to be that accurate, just accurate enough.

I think that would definitely be more accurate; however, that seems like unnecessary background processing.

I thought about it, but would the fact that it’s based on CPU (I assume the client’s CPU) be vulnerable to exploitation?

I assume it would not be difficult for the player to install a little program that tricks Roblox into reading a tampered CPU time

Well, tick() is based off the timezone of the machine running it. A quick change to the timezone of the machine can mess up the timer badly, possibly going negative. Meaning, it would be a lot easier to exploit if you use tick()

1 Like