If the server is the first, sync a value to all other servers

At the current time, I wanted to make a weather system that is controlled by the first server. However, how would I forward the information that the server is the first + send over the info to the others?

Basically how do I get the Server’s line number, so if no one was playing and I joined, it would count me as the server as the first.

So by this I want the first server to control the weather and the others to follow by MessagingService, How would I identify that the server is the first?

I did this using MemoryStoreService. When a server starts, it checks the memory for the value, if it isn’t there, it sets the value, otherwise it just retrieves the value. There are a few other ways to go about it though. You can use datastores, or messaging service, but I think that memorystoreservice is just a better alternative because it’s made for that kind of thing.

So will this help me sync all servers up to the first’s value?

MemoryStoreService works across all servers, so yes. If the value doesn’t exist in memory, then you can set it, otherwise you can just retrieve it.

This would work but how would I detect it being the first server? I dont want people to server hop because the weather isnt what they wanted, i want them to rather wait

i think you mean

dataService = game:GetService('DataStoreService')
dataStore = dataService :GetDataStore('First?')
DataStore:IncrementAsync ('First',1)
game:BindToClose(function()
    DataStore:IncrementAsync ('First',-1)
end)
First = DataStore:GetAsync ('First')

ill check that out if it works soon