-
What do you want to achieve? Keep it simple and clear!
I am trying to make a server list for players to join tons of servers available (not like 100) - What is the issue? Include screenshots / videos if possible!
--// server
local cloud_servers = game:GetService("ReplicatedStorage").cloud.Servers
local communication = game:GetService("MessagingService")
communication:SubscribeAsync("cloud_servers", function(data) --// all servers will begin listening to the communications made
data = data.Data
if data.serverId ~= game.JobId then
local servername = script.Server_Name:Clone()
servername.Name = "Game_" .. #cloud_servers:GetChildren() + 1
servername.Value = data.serverId.. " | " ..data.players
servername.Parent = cloud_servers
task.wait(5)
servername:Destroy()
end
end)
while game.VIPServerId == "" do
local data = {
serverId = game.JobId,
players = #game.Players:GetPlayers()
}
communication:PublishAsync("cloud_servers", data)
task.wait(5)
end
--// client
function init()
local tempframe = {}
for i, servers in pairs(game:GetService("ReplicatedStorage").cloud.Servers:GetChildren()) do
local name = servers.Name
local serverstats = string.split(name, " ")
local id = serverstats[1]
local plrs = serverstats[2]
local template = script.Template:Clone()
template:WaitForChild("Server").Text = name
template:WaitForChild("Players").Text = plrs.."/100"
template:WaitForChild("ID").Text = id
table.insert(tempframe, template)
template.MouseButton1Click:Connect(function()
print(id)
game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, id)
end)
script.Parent.ScrollingFrame:ClearAllChildren()
end
end
game.ReplicatedStorage.cloud.Servers.ChildAdded:Connect(init)
game.ReplicatedStorage.cloud.Servers.ChildRemoved:Connect(init)
I haven’t been in touch with this forum since 2021, and I do hope there would be help anyways. Because I haven’t got any help the last 2 topics I created…