Hello! I would want to know if messages from messaging service can be rechieved from a reserved server. I have a issue where the message is being published and in the reserved server the subscribed function with the same topic doesn’t run. Any help would be greatly appreciated!
Here is the code from the first script (its a server script)
local ServerType = getServerType()
print(ServerType)
local success, errorMsg, connection = pcall(function()
MS:SubscribeAsync("ServerData",function(msg)
if ServerType == "StandardServer" then
print(msg.Data)
local tbl = HS:JSONDecode(msg.Data)
local code = tbl[1]
ServersTable[code] = {tbl[2],tbl[3],tbl[4]}
RS.UpdateServerList:FireAllClients(tbl)
end
end)
end)
RS.CreateServer.OnServerEvent:Connect(function(plr)
if ServerType == "StandardServer" then
local key = TS:ReserveServer(game.PlaceId)
local success, errorMsg = pcall(function()
MS:PublishAsync("NewServer",key)
end)
TS:TeleportToPrivateServer(game.PlaceId,key,{plr})
end
end)
Here is the code from the 2nd server script
local ServerType = getServerType()
wait(1)
local success, errorMsg, connection = pcall(function()
MS:SubscribeAsync("NewServer",function(msg)
if ServerType == "ReservedServer" then
warn("NEW SERVER CREATED")
workspace.OriginalServer.Value = false
local code = msg.Data
local dataTbl = {code,#game.Players:GetPlayers(),workspace.Stats.ActiveCases.Value,getDate(workspace.TIME.Value)}
print(getDate(workspace.TIME.Value))
while wait(3) do
MS:PublishAsync("ServerData",(HS:JSONEncode(dataTbl)))
end
end
end)
end)
Note: the “getServerType()” function is not important. That is just for finding if the server is a standard, reserved or VIP server.