How to save a number value [MessagingService]

I’m trying to save a value that needs to be the same on all servers for all players, and when change, it change for all in all servers, some people recommended me to use MessagingService.

I see some videos about it but no one of the videos are about what I need, they don’t say how to save the value and load all the time in all servers and how to make it don’t change when a new Server is created.

Anyone knows how to make it or where says how to make it (or a thing near that)

1 Like

Messaging Service is all about sending messages to other servers, there’s no option to save a number unless you have new servers request a random server for the existing number, and then keeping that number.

What kind of use case is this needed in? Do you need it for high priority real-time exact number? Or could it be saved through DataStore using UpdateAsync to grab the existing number and update it. UpdateAsync makes a key yield for every other server until it’s saved. (supposedly)

I need to use it to store a number value that if anyone changes, it will change for all players on all servers on the same time and it will save if all servers closes, I already heard when I was playing that they use the Messaging Service to show values for server to server, to gift option and to trade system in 2 players on different servers.

But I can’t find anywhere saying how to make that.

If you don’t need the number to update instantaneously, you could do this all via DataStore with UpdateAsync and OnUpdate. (Roblox will check the key once every minute, GlobalDataStore | Roblox Creator Documentation ) This may be said not to be used in new work, but the limitations of MessagingService’s heavy rate limits makes it difficult to not use it in new work regardless.

If you do need instantaneously, try using both DataStore and MessagingService. DataStore to get the previous number, then request a server for the current number, and when a server updates the number, save the number on DataStore and broadcast via MessagingService.

1 Like

Create a database which updates the value to whats its suppose to be.