Server datastore that transfers through all servers

so im trying to make a server datastore for my game, economy like, and everytime a player changes a value then it will update the datastore and use messagingservice to publishasync to other servers, problem is messagingservice has limits and stuff, and what i need requires constant change, and games have done it before so i know its possible, for example, if i put 3 points into the economy it would update through all of the servers, i heard you can use aerogameframework for this,

can somebody maybe explain how to use aerogameframework .forserver as i couldnt find any tutorials

1 Like
local MessagingService = game:GetService("MessagingService")
local DataStoreService = game:GetService("DataStoreService")
local ValueDataStore = DataStoreService:GetDataStore("Values")
local ServerKey = "fuoqahahgagpohagiagnagiajga"

pcall(function()
	MessagingService:SubscribeAsync("BringValueToDifferentServers", function(Msg)
		local Data = Msg.Data
		script.BroughtMessage.Value = tostring(Data)
	end)
end)


game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(ms, rec)
		local msg = string.lower(ms)
		local split = string.split(msg, " ")
		if split[1] == "!changevalue" then
			MessagingService:PublishAsync("BringValueToDifferentServers", split[2])
			ValueDataStore:SetAsync(ServerKey, split[2])
		end
	end)
end)

when a player chats “!changevalue” the text after that if it has no spaces will save to the value that is inside the script called “BroughtMessage”

Example: !changevalue heybroo

it first saved the data to a datastore
then goes to all servers setting the broughtmessage value to what ever u write.

These type of things are used for global messages in games like pls donate