Regardless if you know how Roblox works or if you know Lua syntax, I just need an algorithm/equation here.

Currently, at the start of each server, I reference the seconds of a centralized clock since 00:00:00 June 1, 1970 (UTC). I want to synchronize all servers in-game times by referencing the same clock and then run at a fraction of real world's time in each server separately. So I have a ratio of a real-world second to my in-game second.

Where I'm stuck at though is when I start a server, then a second one at 100 seconds later, I'm referencing real-world time at the start of both, but the first one has already ran 100 in-game seconds so it's now out of sync.

I'm trying not to have to make a shared value from which to pull the only clock onto every server. So is there any possible way to use like a catch-up function? So I catch up from the time missed out between those real world 100 seconds that is now like 1 hour differential between servers?

Any algorithms or equations for that?

  • 2
    \$\begingroup\$ Why not take the seconds since epoch and divide them by a factor to get your current ingame time? \$\endgroup\$
    – Philipp
    Commented May 6, 2023 at 10:34

1 Answer 1


Try os.date:

local date = os.date("!*t")
local minute = (date.hour + [A number for timezones]) * 60 + date.min
  • 1
    \$\begingroup\$ This question could be improved by additionally commenting on how this code is solving OP's issue. \$\endgroup\$
    – liggiorgio
    Commented Sep 6, 2023 at 12:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .