hi, I’m making a system where if there is a private server, then it would send some data, to create a private server list, but its not sending any data over. When i play in the roblox client it just says nil and when i sent the data over and i printed the index’s of the table it returns 0.
code -
local module = {}
local MessagingSerivce = game:GetService("MessagingService")
local ReplicatedStoarge = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local ServerFolder = ReplicatedStoarge.Servers
local CreateServerGui = ReplicatedStoarge.RoomSystem.CreateServerGui
function module.SubscribeAllServers()
print("Subscribed all serers")
MessagingSerivce:SubscribeAsync("ServerList", function(data)
print(data[1])
data = data.Data
print(data[1], data[2], data[3])
if data.PrivateServerId ~= "" then
print("Making Ui", data)
print("Making Ui")
CreateServerGui:FireAllClients(data)
task.wait(5)
end
end)
end
function module.PublishServers()
print("Publishing if privite")
while game.PrivateServerId ~= "" do
print("Game is pritive")
local PlayersInServers = {}
for i,v in Players:GetPlayers() do
table.insert(PlayersInServers, v.UserId)
end
local data = {
PlayersInServers;
game:GetService("ServerStorage"):GetAttribute("ServerName");
game.PrivateServerId;
"hello"
}
MessagingSerivce:PublishAsync("ServerList", data)
print(#data)
print("rolling over")
task.wait(5)
end
end
return module
thank you!