Run a event on all servers

Hello! I would like when a player press a button, all servers of the game receive a event. Could you help me please?

1 Like

Hey there!

I think a MessagingService will be a solution for you.
It is used to communicate between game’s servers.
Here is API:

I hope this helped.
Have a nice day!

1 Like

MessagingService can send a message to all server but how to save game datas (To make a global leaderstat by exemple) ?

In that case you use Data Store Service and Ordered Data Stores.

I didn’t really understand OrderedDataStoe. It is like a list of values?

It’s a data store that can store positive integers and can return them in a list from highest to lowest.
Of course this doesn’t work with any other value that’s not a positive integer.

If I try to store this,

local DataStoreService = game:GetService("DataStoreService")
local data= DataStoreService:GetOrderedDataStore("Park")

data:SetAsync("Hello", 1)
data:SetAsync("World", 2)

Store this script a list who look like {“Hello”, “World”} ?