Trying to make a global market script that updates in every server however Im experiencing issues where a freshly server has been created. The data does not want to transfer over from the old server to the new one. This is my code but it does not work that great, any help would be greatly appreciated!
local marketListings = {}
local function publishMarketListing(sellerPrice, owner, selectedItem)
table.insert(marketListings, {
sellerPrice = sellerPrice,
selectedItem = selectedItem,
owner = owner.Name
})
local success, err = pcall(function()
MessagingService:PublishAsync("MarketListing", {
marketListings = marketListings
})
end)
if not success then
warn("Failed to publish message: " .. tostring(err))
end
end
MessagingService:SubscribeAsync("MarketListing", function(messageData)
if messageData and typeof(messageData) == "table" then
updateLocalMarketEvent:FireAllClients(messageData.Data.marketListings)
end
end)