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

How to make GlobalAnnoucment System?

I want it so if I want to announce something to all the players that are playing my game I can. If you have can you give me a forum from the wiki or dev hub? Also, only one person can do this. So it has perms.

2 comments

0

People use this for most global announcements. https://developer.roblox.com/en-us/api-reference/class/MessagingService

1 answer

Try this

-- Global message system


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)

1 comment

0

How does this work?

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