Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Messaging Service Global Announcements?

Asked by 5 years ago

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.

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. Ziffixture 6913 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

0
please accept answer if you like it mattchew1010_2 -2 — 5y
0
Wait, you need to be in the Beta Program to use Messaging Service? JakyeRU 637 — 5y
0
yes for now BenSBk 781 — 5y
Ad

Answer this question