Hello! So I’m making a ServerList, but something’s not working right, so it should add a Server, but, When I do SubscrybeAsync(“GiveServers2”) It’s not working, no errors
local jobId = game.JobId;
local MessagingService = game:GetService("MessagingService")
MessagingService:SubscribeAsync("ReturnServer", function(Message)
print("GiveInfo")
MessagingService:PublishAsync("GiveServers2", jobId.." "..#game.Players:GetPlayers())
end)
--if not game:GetService("RunService"):IsStudio() then
game:BindToClose(function()
local Send = (game.JobId..#game.Players:GetPlayers())
print("Closing")
MessagingService:PublishAsync("ClosingServer", Send)
end)
--end
local serverListDS = game:GetService("DataStoreService"):GetDataStore("ServerList");
local jobId = game.JobId;
local MessagingService = game:GetService("MessagingService")
local Servers = 0
MessagingService:SubscribeAsync("ClosingServer", function(Message)
if Message then
local decoded = Message.Data:split(" ")
print("REMOVE "..decoded[1])
Servers = Servers - 1
game.ReplicatedStorage.RemoteFunction:FireClient(game.Players:FindFirstChildWhichIsA("Player"), "ClosingServer", decoded[1], decoded[2])
end
end)
game.ReplicatedStorage.ok.OnServerInvoke = function(Player)
return Servers
end
MessagingService:PublishAsync("ReturnServer", "RETURNINGINFO")
MessagingService:SubscribeAsync("RefreshServer", function(Message)
if Message ~= "RETURNINGINFO" then
local Decode = Message.Data:split(" ")
print(Decode[2])
game.ReplicatedStorage.RemoteFunction:FireClient(game.Players:FindFirstChildWhichIsA("Player"), "RefreshServer", Decode[1],Decode[2])
end
end)
MessagingService:SubscribeAsync("GiveServers2", function(Message)
print("GiveServer")
local Decode = Message.Data:split(" ")
Servers = Servers + 1
print(Servers)
print(Decode[2])
game.ReplicatedStorage.RemoteFunction:FireClient(game.Players:FindFirstChildWhichIsA("Player"), "OpeningServer", Decode[1],Decode[2])
end)
It should display the servers, but nope.