Hi, I was recently referred in this post to TimeSyncManager made by @Quenty . It is a module that helps sync time between server and client. But wait, theres a problem…
I don’t know how it works, and don’t understand what does what enough to actually want to use the module. If anyone could care to explain, I would really appreciate it. Thank you.
I’ve come across a post like that over here , you can use it to calculate the time passed after an event has fired, or for synchronized time between the Client and the Server.
Then, you can get a synced clock, which is guaranteed to be synced.
-- main script, does not yield, so this on the client and server
require("TimeSyncService"):Init()
-- other script
local TimeSyncService = require("TimeSyncService")
local syncedClock = TimeSyncService:GetSyncedClock() -- Yielding potentially on client!
print(syncedClock:GetTime())
Alternatively you can use promises to get a synced clock:
-- main script, does not yield
require("TimeSyncService"):Init()
-- other script
local TimeSyncService = require("TimeSyncService")
-- yay no yielding
TimeSyncService:PromiseSyncedClock():Then(function(syncedClock)
print(syncedClock:GetTime())
end)
This will result in a timestamp that is synchronized with the server! Accuracy is ± 1/30
How do I import it? I think I’m missing something. I imported the time sync script directly, but it looks for several other subscripts, it appears. Is there an easy way to install, or some sort of guide?