How to get ACCURATELY (up to tenth of a sec) the delay between the client and the server when using remotes?


I was wondering what could I use to track the delay between the client and the server, os.time() doesn’t give me an accurate value as it is always rounded to a sec. I tried using tick(), but even when taking the timezone diff between the client and the serv, it seems like its not accurate too.

Example :

--local script
local timestamp = tick()
local WaitForResp = remote:InvokeServer(timestamp)
local local_time_diff = tick() - timestamp 

-- serverscript
remote.OnServerInvoke = function(plr, timestamp)
     timestamp = timestamp - plr.TimeZone.Value --(smthing i created before tracking if its +2, +1,... and * 3600 so its in sec too)
     local Serv_time_diff = tick() - timestamp
     print("delay :", Serv_time_diff)

I have tried this multiple times on an actual server (not in studio), and sometimes, the local_time_diff is smaller then the Serv_time_diff (which shouldn’t happen and be possible). This proves that I can’t use tick() accuratly for this.

  • on the client

  • on the server

I don’t know how I could get an accurate timing of the delay between the invoke and the oninvoke…

Any ideas ?

Thx for reading

1 Like

so no other way but to spam remotes and calculate the delay this way ? :confused:

Refreshing the ping of everyone every 5 seconds is hardly spam.

But anything can happen in those 5 seconds, I don’t find this “very accurate”

1 Like