Hi! This is just a very simple question, I currently use time() for lap times in my racing game. I am worried time() may be affected by server lag. Should I use os.time() for more accurancy, or time()?
For your racing game, use tick()
instead of time()
or os.time()
because it provides precise, real-world timing (including milliseconds) and is not affected by server lag.
You should use time(). os.time() returns UTC time which can do strange stuff because of the need to keep it synced with the calendar and solar days. You must also make sure to only compare time() returned on the same machine. I.e. always use it on the server.
what about tick()? i think server lag affects time() lol
tick() is deprecated.
Since your game could lag, you want your times to also be affected by server lag. Otherwise, confusingly, your lap times will be affected by lag and players on less laggy servers will have better times.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.