How would I go around syncing a global value across all servers?

Reference: 🕒 The Final Countdown! - Roblox

I’m trying to create a value that will be shared across all servers, and it will be edited quite frequently. How would I go around making a reliable way for all server values to be synced, and if a new server opens, the value is synced as well?

Thanks.

You would use a combination of DataStoreService and MessagingService:

  • When the game first starts counting down, you should save the current os.time().

  • Whenever someone does something to speed up the countdown, you should:
    - Update a second datastore to add the time you want to speed it up by.
    - Use MessagingService to notify other servers of the change, prompting them to readjust their time from the new datastore value.

  • The time remaining will be the value in the first datastore + 1 million, minus the value in the second datastore and minus the current os.time()

I have thought about this, but won’t I quickly hit the rate limit if I have many servers?

Shouldn’t do. Messaging service is intended for this sort of thing. As long as you only send a signal when required, you should be fine

1 Like