local Http = game:GetService("HttpService") local TPS = game:GetService("TeleportService") local Api = "https://games.roblox.com/v1/games/" local placeId = game.PlaceId local highestPlayerCount = 0 local targetServerId = nil -- Create Notification GUI local screenGui = Instance.new("ScreenGui") local notificationFrame = Instance.new("Frame") local notificationLabel = Instance.new("TextLabel") screenGui.Name = "NotificationGui" screenGui.Parent = game.CoreGui notificationFrame.Name = "NotificationFrame" notificationFrame.Size = UDim2.new(0.5, 0, 0.1, 0) notificationFrame.Position = UDim2.new(0.25, 0, 0.9, 0) notificationFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) notificationFrame.BackgroundTransparency = 0.5 notificationFrame.BorderSizePixel = 0 notificationFrame.Parent = screenGui notificationLabel.Name = "NotificationLabel" notificationLabel.Size = UDim2.new(1, 0, 1, 0) notificationLabel.BackgroundTransparency = 1 notificationLabel.TextColor3 = Color3.fromRGB(255, 255, 255) notificationLabel.TextScaled = true notificationLabel.Text = "Searching for servers..." notificationLabel.Parent = notificationFrame -- Function to list servers local function ListServers(cursor) local url = Api .. placeId .. "/servers/Public?sortOrder=Asc&limit=100" if cursor then url = url .. "&cursor=" .. cursor end local success, response = pcall(function() return game:HttpGet(url) end) if success then return Http:JSONDecode(response) else warn("HTTP request failed: " .. response) return nil end end -- Display notification local function showNotification(message) notificationLabel.Text = message notificationFrame.Visible = true wait(3) -- Display for 3 seconds notificationFrame.Visible = false end -- Loop to find the server with the highest player count local nextCursor = nil repeat showNotification("Finding servers...") -- Rate limiting with a delay local servers = ListServers(nextCursor) if not servers then wait(5) -- Wait before retrying if there's an error nextCursor = nil -- Exit loop if we can't fetch servers break end for _, server in ipairs(servers.data) do if server.playing > highestPlayerCount and server.maxPlayers > server.playing then highestPlayerCount = server.playing targetServerId = server.id end end nextCursor = servers.nextPageCursor wait(1) -- Delay between requests to avoid hitting rate limits until not nextCursor if targetServerId then showNotification("Teleporting to server with " .. highestPlayerCount .. " players.") wait(1) -- Wait for a second before teleporting TPS:TeleportToPlaceInstance(placeId, targetServerId, game.Players.LocalPlayer) else warn("No suitable server found.") showNotification("No suitable server found.") end