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

How to use Messaging Service?

Asked by 5 years ago

I found a new service called Messaging Service and I looked at it's features and it sounds cool, I tried to use it in my game, but I get this error that I'm not sure what it means.I have http requests enabled!enter image description here

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 FilteredMsg = game:GetService("Chat"):FilterStringForBroadcast(msg, player)

local messageData = {

sender = player.Name,

message = FilteredMsg,

}

local encoded = httpService:JSONEncode(messageData)

messagingService:PublishAsync("Chat", encoded)

end)

end)

messagingService:SubscribeAsync("Chat", callbackFunction)

1
You have to be a beta tester on the DevForum to access MessagingService. RSASDSA 72 — 5y
0
Alright Thanks. SuperSamyGamer 316 — 5y
0
MessagingService got released though. xChris_vC 5 — 5y
0
This was 3 months ago.. SuperSamyGamer 316 — 5y

Answer this question