I’m trying to make an admin event thats global, or can be global, like a command similar to :GlobalEvent (players name), and the event will happen in that players server, and i need to know how to make a global event like, :GlobalEvent all, and that will make the event happen in all servers.
if there is a forum post on this, could someone please send it, i couldnt find it after looking.
Use MessagingService
to achieve this, MessagingService allows for you to Publish
A topic and then Subscribe
to that topic
-- I believe it is this. Make sure you subscribe first then publish anything after
MessagingService:SubscribeAsync(function(topicName: string, data)
if Players:FindFirstChild(data.playerName) then
print("Located Player's Server")
if data.eventType == "kill" then
workspace:FindFirstChild(data.playerName).Humanoid:TakeDamage(100)
end
end
end)
-- I believe this it it also
MessagingService:PublishAsync("GlobalEvent", {playerName = "yousifto12", eventType = "kill")
I’m not entirely familiar with MessagingService but I believe this is correct.
You need some way of finding what server that player is in, which you could probably do via a data store. Then you need to route the command to that server using the messaging api, which I haven’t used so I’m not sure how, but I know it’s possible.
I was mistaken, you don’t need to know what server the player’s in because you can send a message to every server.
Yeah if I remember I think this is the way the game Doors
uses to target a Streamers / Content Creators game to spawn in monsters, maybe Pls Donate
as well to use Live Leaderboard or in modern sense Grow A Garden
to control custom weather (Monster Mash, Chocolate Rain).
thx ill try it out, but could you maybe send the link to messaging service and how to use it?
Yes, sorry for the late reply as I was busy over the weekend and you may of already figured it out, but here you go