How to make data work with other servers?

So I wanna make a catalog for my game, but to do this and create items I want other servers to be able to buy an item from the catalog too, but I don’t know how I would make it so other servers get the catalog item too. so for example, you create an item with something that looks like this: image
so how do I make this work server to server when I create an item in 1 server?
(using some sort of data-store system?)

2 Likes

It’d be nice for GlobalDataStore:OnUpdate to work properly for situations like this. At the moment, the only solution for cross-server communication is constantly polling GlobalDataStore:GetAsync for a specific key until an update is found (through GlobalDataStore:SetAsync on that same key from a different server). Keep in mind the cache cooldown of 5 seconds.

This is mostly speculation, but I believe a less hacky solution will be available for cases like this soon:

The use of this service may look something like this:

local messagingService = game:GetService("MessagingService")

if isPublisher then
    messagingService:PublishAsync("catalogUpdate", {Stock = 10, Price = 5, Name = "pizza", AssetId = 123})
else
    messagingService:SubscribeAsync("catalogUpdate", function(message)
        makeItem(message.Stock, message.Price, message.Name, message.AssetId)
    end)
end
5 Likes

Thanks for replying, I’ve also heard that the “OnUpdate” was broken and it makes it very hard, cause the servers will never really sync completly as if I had a 10 stock it still would allow users from 2 servers to get 20 items with the servers combind!

1 Like

OnUpdate will work if GetAsync is used in a loop on the same key, meaning that if you loop GetAsync in all servers every 10 seconds or so OnUpdate will work fine (problem is it will only fire every 10 seconds, really weird glitch).

1 Like