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

How to make GlobalAnnoucment System? [closed]

Asked by 4 years ago

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.

0
People use this for most global announcements. https://developer.roblox.com/en-us/api-reference/class/MessagingService NotedAPI 810 — 4y

Closed as Not Constructive by Luka_Gaming07 and hiimgoodpack

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 4 years ago

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)
0
How does this work? Alibolly 10 — 4y
Ad