How would I make something happen in servers at the same time?
1 Like
So, this would help me make something happen for example UIchanging? This seems to be for messages for all servers.
MessagingService will send a message to every server of your game saying whatever you want. You can detect for the message, then have the UI change.
1 Like
Could you give an example of it being used?
So, Something Like this?
local MessagingService = game:GetService("MessagingService")
local ChangeGame = {
Game1 = 1,
Game2 = 2,
Game3 = 3
}
MessagingService:PublishAsync(ChangeGame[math.random(1,#ChangeGame)])
How would I receive the information?
Make the first parameter the topic.
Example:
MessagingService:PublishAsync("ChangingGame", ChangeGame[math.random(1,#ChangeGame)])
To receive the information you’ll have to use SubscribeAsync.
Example:
local Success, Connection = pcall(function()
return MessagingService:SubscribeAsync("ChangingGame", function(Game)
print(Game)
end)
end)
1 Like
So how would I receive the information that was sent?