Quick Question about Messaging Serveries

I have a quick question about how Message Service works…

The parameter of PublishAsync, message which is a Variant.
Does this mean I can only pass a string? Or does passing the Values Table I made work completely fine?

local MessagingService = game:GetService("MessagingService")
local Values = {
  Num = 5,
  String = "Boom",
  Bool = true
}

local PublishSuccess, PublishResult = pcall(function()
    MessagingService:PublishAsync("Topic", Values)
end)

game.Players.PlayerAdded:Connect(function(Player)
    local Connection = MessagingService:SubscribeAsync("Topic", function(Value)
        print(Value.Num, Value.String, Value.Boom)
    end)

    Player.AncestryChanged:connect(function()
        -- Unsub from topic.
        Connection:Disconnect()
    end)
end)
1 Like

I’m pretty sure you cant pass a table.

1 Like

That means you can pass just about any type of value (string, number, etc) and you CAN pass a table.

2 Likes