Issue with MessaginService?

https://gyazo.com/a023ff2c8e3a63eabf7f0757aca00592

For some reason the JSON isn’t getting decoded? What am I doing wrong?

local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")
local MessagingService = game:GetService("MessagingService")
MessagingService:SubscribeAsync("Servers",function(Message)

--Stuff Here

local decodedData = HttpService:JSONDecode(Message.Data)
print(decodedData)
end)

while true do

local Data = {
game.JobId -- This will return the job id from the current server of your game
}

local Encoded = HttpService:JSONEncode(Data)
local Sucess,Error = pcall(function()
MessagingService:PublishAsync("Servers",Encoded)

end)
task.wait(5)
end
1 Like

Hmm, where are you actually decoding it ?

Sorry I edited it, I was doing another test without it to see if I got the same results. Decode is in there.

1 Like

I hope you’re using JSONDecode() on a string

I guess not.

game.JobId is that data being sent. I’m trying to send some sort of server id too all servers. I want to make a server list UI eventually.

Is there another way to send some sort of identifier for a server?

Edit: never mind I figured it out.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.