Making a timing system calculate 0.01 accurately?

Hey there!

I added a new update to our game RoStock Racing - Roblox yesterday, and in that update I added time positions of cars after finishing a race.

The problem is I cannot track past 0.03 with wait() or task.wait(), otherwise it cannot track accurately and lags considerably.

I decided to play it safe and just stick with 0.1 seconds of tracking, the issue is we have so many close finishes that a lot of people all end up with 0.0 because they finish right after the leader.

How can I get around this issue?

For the finish line, could you do some sort of hit detection and just track which one hit it first? You can use time() or os.clock() to grab the current time.

2 Likes

will the time give me the milliseconds?

Yep I recommend os.clock()

Returns the amount of CPU time used by Lua in seconds. This value has high precision, about 1 microsecond, and is intended for use in benchmarking.