Learn
Engine Class
MessagingService
Not Creatable
Service
Not Replicated

Summary
Methods
PublishAsync(topic: string,message: Variant):()
Inherited Members

API Reference
Methods
PublishAsync
Yields
Capabilities: ServerCommunication
MessagingService:PublishAsync(
topic:string, message:Variant
):()
Parameters
topic:string
message:Variant
Returns
()

SubscribeAsync
Yields
Capabilities: ServerCommunication
MessagingService:SubscribeAsync(
topic:string, callback:function
Parameters
topic:string
callback:function
Code Samples
Subscribing to Cross Server Messages
local MessagingService = game:GetService("MessagingService")
local Players = game:GetService("Players")
local function onPlayerAdded(player)
--subscribe to the topic
local topic = "player-" .. player.UserId
local connection = MessagingService:SubscribeAsync(topic, function(message)
print("Received message for", player.Name, message.Data)
end)
player.AncestryChanged:Connect(function()
-- unsubscribe from the topic
connection:Disconnect()
end)
end
Players.PlayerAdded:Connect(onPlayerAdded)

©2026 Roblox Corporation. Roblox, the Roblox logo and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.