You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
I want to create a server list of a specific server underneath my start place. Server list includes player count, the server id for that server. Server list should only show servers that don’t have max players. -
What is the issue? Include screenshots / videos if possible!
The issue is that it just isn’t working how it’s supposed to. It isn’t setting the right server up in the server list. Also it doesnt teleport me to that right server either. It keeps setting up my start place and not the specific place underneath my startplace. Also that server keeps cloning every 60 seconds making the game laggy. I only want servers to be shown that are running. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have looked all over devForum and it seems nobody has figured this out either. I also have watched a youtube video but that video seems old and nothing works there either.
-- Client Code
function updateList()
local serverFrames = {}
for i, serverValue in pairs(game.ReplicatedStorage.Servers:GetChildren()) do
local name = serverValue.Name
local serverStats = string.split(serverValue.Value, " ")
local id = serverStats[1]
local plrs = serverStats[2]
local jobId = serverStats[3]
local serverFrame = script.Parent.BackGround.ServerFrame.Frame1:Clone()
serverFrame.Visible = true
serverFrame:WaitForChild("ServerNumber").Text = name .. "\n ID: " .. id .. "-" .. jobId
serverFrame:WaitForChild("PlayerNumber").Text = plrs .. "/18"
table.insert(serverFrames, serverFrame)
serverFrame.SubHead1.TeleportButton.MouseButton1Click:Connect(function()
game:GetService("TeleportService"):TeleportToPlaceInstance(id, jobId)
end)
local function updateHUD(awayText, homeText, awayLogo, homeLogo, quarter, timeLeft)
script.Parent.BackGround.AwayLabel.Text = awayText
script.Parent.BackGround.HomeLabel.Text = homeText
-- Check if awayLogo and homeLogo are not nil before assigning them to the Image property
if awayLogo then
serverFrame.Teams.AwayTeam.TeamIcon.Image = awayLogo
else
-- Set a default image URL if awayLogo is nil
serverFrame.Teams.AwayTeam.TeamIcon.Image = "rbxassetid://default_away_logo_id"
end
if homeLogo then
serverFrame.Teams.HomeTeam.TeamIcon.Image = homeLogo
else
-- Set a default image URL if homeLogo is nil
serverFrame.Teams.HomeTeam.TeamIcon.Image = "rbxassetid://default_home_logo_id"
end
serverFrame.QtrNumber.Text = quarter
serverFrame.ClkNumber.Text = timeLeft
end
for i, serverFrame in pairs(serverFrames) do
serverFrame.Parent = script.Parent.BackGround.ServerFrame
end
-- Invoke the server function to get the updated data
local data = remoteFunction:InvokeServer("GetServerData")
if data then
updateHUD(data.Teams[1], data.Teams[2], data.TeamLogos["Away"], data.TeamLogos["Home"], data.Quarter, data.TimeLeft)
end
end
end
-- CONNECTS --
updateList()
game.ReplicatedStorage.Servers.ChildAdded:Connect(updateList)
game.ReplicatedStorage.Servers.ChildRemoved:Connect(updateList)
-- Server Code
messagingService:SubscribeAsync("ServerList", function(data)
data = data.Data
if data.serverId ~= data.jobId then
local serverValue = script.ServerName:Clone()
serverValue.Name = "Server" .. #serverFolder:GetChildren() + 1
serverValue.Value = data.serverId .. " " .. data.players .. " " .. data.jobId
serverValue.Parent = serverFolder
wait(60)
serverValue:Destroy()
end
end)
while game.VIPServerId == "" do
local data = {
serverId = 17283053947, -- Set the server ID to the specific game place ID
players = #game.Players:GetPlayers(),
jobId = game.JobId
}
messagingService:PublishAsync("ServerList", data)
wait(60)
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.