Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Messaging Service Global Announcements?

Hello everyone! I recently asked how to make a announcement system with model descriptions. Later on I found out that there is a new api called Messaging Service. Now my question. How do I use it to create a announcement system that syncs over all active servers? Thanks for your help.

1 comment

0

I believe this doesn't apply to your objective, if so then this would be very helpful ROBLOX, but I stick with my statement so you'll have to use the ol' method with .OnUpdate() of the DS-API.

1 answer

first of all you need to be a beta member if you are not heres the link to join it: Beta Program
after you are a beta program member (which will take a while) you can make a regular script and put this example code in it

local Players = game:GetService("Players") 
local httpService = game:GetService("HttpService") 
local messagingService = game:GetService("MessagingService") 
function callbackFunction(serviceData)  
local decodedData = httpService:JSONDecode(serviceData.data)
print(decodedData.sender.." : "..decodedData.message)
 end) 
 
 Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg)  
 local messageData = { sender = player.Name, message = msg, -- filter message first! } 
 local encoded = httpService:JSONEncode(messageData)
 messagingService:PublishAsync("Chat", encoded) 
     end) 
 end) 

 messagingService:SubscribeAsync("Chat", callbackFunction)

sorry for bad indenting btw

3 comments

0

please accept answer if you like it

0

Wait, you need to be in the Beta Program to use Messaging Service?

0

yes for now

This discussion is preserved as it was. New answers, comments, and votes are closed.