How to make a datastore update on every game server

The title explains it all. Would I be able to fire a BindableEvent or update a datastore throughout all servers at the same time?
(Like different game servers)

If you know the time the event will take place, then it would be trivial. If you’re trying to fire a remote event on demand across all servers at the exact same time it’s not easy and will involve latency and restrictions.

If you know the exact time the event should fire, then it’s as simple as subtracting the time it happens at from the current time and task.waiting that time (I recommend using milliseconds to be as precise as possible. If you use milliseconds you’ll need to divide the value by 1000 to put it into seconds for task.wait, but the additional decimal places means it’s more accurate). I.e.

task.wait((eventTimeMs-currentTimeMs)/1000)
event:Fire()

(Given eventTimeMs is known and static across all servers, this should fire within 50ms of each other on all servers)

If you want to fire events cross server on demand without a preset date, the best way I can think of is using MessagingService, but this will add some latency. If timing doesn’t have to be precise, then you can just use that, but you’ll have to be able to handle duplicate events firing due to an decentralized messaging system. You also have to keep in mind MessagingService rate limits and restrictions.

1 Like

You’ll need to make use of cross-server messaging to allow for servers to communicate with one another to organise a synchronised DataStore save.