Server list not working

When multiple servers are running, the Gui doesn’t clone again and is stuck and glitches as one Gui.

https://gyazo.com/6a574994d9073057c172efe6665eb2d9
In the video, it shows 2 servers active. There should be a second server option, but it’s stuck at one and it creates these looping server options in the same Gui. I cannot figure out why.

-- server script

local messagingService = game:GetService("MessagingService")
local rep_storage = game:GetService("ReplicatedStorage")

messagingService:SubscribeAsync("test",function(Messages)
	local allTheData = Messages.Data	
	
	if allTheData then
		if allTheData[1] ~= game.JobId then
			local serverValue = rep_storage.Server_Name:Clone()
			serverValue.Name = "Server" .. #rep_storage.Servers:GetChildren() + 1
			
			local server_Plr_Count = rep_storage.Server_Plr_Count:Clone()
			server_Plr_Count.Value = allTheData[3]
			server_Plr_Count.Parent = serverValue
			
			serverValue.Value = allTheData[1]
			serverValue.Parent = rep_storage.Servers
			task.wait(1)
			serverValue:Destroy()
			server_Plr_Count:Destroy()
		end
	end
end)

-- local script

local localPlayer = game.Players.LocalPlayer

local function update_Gui()

	for _,serverValues in pairs(game.ReplicatedStorage.Servers:GetChildren()) do
		local name = serverValues.Name

		local id = serverValues.Value
		local plrs = serverValues:WaitForChild("Server_Plr_Count")

		local server_Frame = script.server_thing:Clone()

		server_Frame.server_Name.Text = name
		server_Frame.ID.Text = id
		server_Frame.plr_Count.Text = plrs.Value .. "/30"


		server_Frame.TextButton.Activated:Connect(function()
			game:GetService("TeleportService"):TeleportToPlaceInstance(9925317683, id, localPlayer)

		end)
		
		
		for _,v in pairs(script.Parent.servers_:GetChildren()) do
			if not v:IsA("UIListLayout") then
				v:Destroy()
			end
		end
		server_Frame.Parent=localPlayer.PlayerGui.ScreenGui.servers_	

	end
end


update_Gui()

game.ReplicatedStorage.Servers.ChildAdded:Connect(update_Gui)

game.ReplicatedStorage.Servers.ChildRemoved:Connect(update_Gui)


script.Parent.create_new_server.Activated:Connect(function()
	
	game:GetService("TeleportService"):Teleport(9925317683, localPlayer)
end)

Is your UIListElement a child of your servers_ UI element? If so, check if the UIListElement has the correct dimensions set up.

Hi, I’ve already solved the issue a while ago. Thanks anyways.

1 Like

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