I came across MessagingService a couple days ago, and am still a little but confused on it, and exactly how it works. Would anyone be kind enough to give a detailed explanation?
For example also, spawning a part for all servers with messagingservice as an extra if anyone can.
Why do you need a detailed explanation?? I just use the docs for every question I have it doesn’t leave anything out from my understanding. Just try coding it or copy someone else’s code ( if you want to learn it type it out ).
That’s what I’ve been doing and why I need an explanation, because its hard to understand, especially if you want to pull complex functions through.
Hmm okay
well the basic idea is that you are able to publish a message with a tag “Topic”
and every SubscribeAsync takes the message if the topic is the same
Is there something specific you don’t get about it? I don’t really know how to explain this in detail.
Well I understand that for the most part, thanks, but it’s just the function part I don’t get, first there’s a callback on :SubscribeAsync(), and then there’s also a message for :PublishAsync()
For example, how would I go about making a part like this, would this be good?
local Players = game:GetService("Players")
local messagingService = game:GetService("MessagingService")
function makePart()
local part = Instance.new("Part",workspace)
part.Position = Vector3.new(0,0,0)
end
messagingService:SubscribeAsync("DonationTopic", makePart) -- callback here
messagingService:PublishAsync("DonationTopic") -- message here, purpose i dont understand if we are using a function
MessagingService messages travel across all servers, each server can hook a function with SubscribeAsync and a server can call PublishAsync to call the function each server hooked
If I subscribe to a topic, then I post a message, will the sending server also get this message?
I have a game that uses two different topics for messaging, one it seems like the sender does not get their broadcast message, and the other it does…