Avoiding Duplicate Discord Messages from Multiple Roblox Servers

I’ve set up a feature to announce the weekly top three leaderboard players in a Discord channel via webhooks, using OrderedDataStores. It’s functional, but with the game running on multiple servers, each server sends the same Discord message when the week ends, leading to duplicate messages.

How do I ensure this notification is sent just once, collectively, rather than per server. Any suggestions to achieve this would be greatly appreciated!

Options considered:

  1. Checking if a server is the “oldest” to exclusively send the Discord message, though not sure if it’s possible.
  2. Using a DataStore boolean to flag when the message is sent, but concerned about latency leading to duplicate messages.
  3. Considering MemoryStoreService for its faster performance, yet unsure of its suitability for this case.
3 Likes

you could delay the code that sends the notification by a random amount of seconds (so they dont run in all servers at once) and on the server that the delay is the smallest set a datastore that tells other servers that the notification has been sent and then actually send the notification

2 Likes

So, instead of all servers sending notifications simultaneously, I could randomize the week’s end over an hour, ensuring no two servers are within 2 or 3 seconds of each other, and then use a DataStore flag?

1 Like

I actually made a webhook rate limit queue system. Since webhooks were being sent from every single server it’d be impossible to tell what the rate limit was at unless one master server was used.

To make it I used this master server module that someone made:

I do believe it had some errors and bugs that I had to fix but I played around with it and got it working. Now I have a very easy to use webhook rate limiter that I use for all my games!

Hope this helps!

3 Likes