Advertisement
2AreYouMental110

server hopper

Apr 5th, 2023 (edited)
1,215
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.56 KB | None | 1 0
  1. local destroyed = false
  2. local httpservice = game:GetService("HttpService")
  3. local tpservice = game:GetService("TeleportService")
  4. local joinfuncs = {}
  5. local serverstorage
  6. request = request or syn.request or http.request or fluxus.request
  7. if getgenv().serverhopgui then
  8.     getgenv().serverhopgui:Destroy()
  9. end
  10. getgenv().serverhopgui = Instance.new("ScreenGui")
  11. serverhopgui.Parent = game.CoreGui
  12. local a = serverhopgui.Destroying:Connect(function()
  13.     destroyed = true
  14. end)
  15. local mainframe = Instance.new("ScrollingFrame")
  16. mainframe.Parent = serverhopgui
  17. mainframe.Size = UDim2.new(.15,0,.6,0)
  18. mainframe.Position = UDim2.new(.43,0,.175,0)
  19. mainframe.Active = true
  20. mainframe.Draggable = true
  21. mainframe.BackgroundColor3 = Color3.fromRGB(60,60,60)
  22. mainframe.BorderColor3 = Color3.fromRGB(255,255,255)
  23. mainframe.ScrollBarImageTransparency = 0
  24. local credits = Instance.new("TextLabel")
  25. credits.Parent = mainframe
  26. credits.Size = UDim2.new(.95,0,0,50)
  27. credits.BackgroundColor3 = Color3.fromRGB(60,60,60)
  28. credits.BorderColor3 = Color3.fromRGB(255,255,255)
  29. credits.TextColor3 = Color3.fromRGB(255,255,255)
  30. credits.TextScaled = true
  31. credits.Text = [[Server Hopper
  32. this only shows the first 100 servers thats the max sorry]]
  33. local credits2 = Instance.new("TextLabel")
  34. credits2.Parent = mainframe
  35. credits2.Size = UDim2.new(.95,0,0,60)
  36. credits2.BackgroundColor3 = Color3.fromRGB(60,60,60)
  37. credits2.BorderColor3 = Color3.fromRGB(255,255,255)
  38. credits2.TextColor3 = Color3.fromRGB(255,255,255)
  39. credits2.TextScaled = true
  40. credits2.Text = "Made By 2AreYouMental110, with some help from infinite yield"
  41. local sort = Instance.new("UIListLayout")
  42. sort.Parent = mainframe
  43. function createserver(serverid,playing,max)
  44.     local serverframe = Instance.new("Frame")
  45.     serverframe.Parent = mainframe
  46.     serverframe.Size = UDim2.new(.95,0,0,50)
  47.     serverframe.BackgroundColor3 = Color3.fromRGB(60,60,60)
  48.     serverframe.BorderColor3 = Color3.fromRGB(255,255,255)
  49.     local joinbutton = Instance.new("TextButton")
  50.     joinbutton.Parent = serverframe
  51.     joinbutton.Size = UDim2.new(.5,0,.5,0)
  52.     joinbutton.Position = UDim2.new(.5,0,0,0)
  53.     joinbutton.TextColor3 = Color3.fromRGB(255,255,255)
  54.     joinbutton.TextScaled = true
  55.     joinbutton.BackgroundColor3 = Color3.fromRGB(0,255,0)
  56.     joinbutton.BorderColor3 = Color3.fromRGB(255,255,255)
  57.     joinbutton.Text = "Join Server"
  58.     table.insert(joinfuncs,joinbutton.MouseButton1Click:Connect(function()
  59.         tpservice:TeleportToPlaceInstance(game.PlaceId,serverid,game.Players.LocalPlayer)
  60.     end))
  61.     local playingtext = Instance.new("TextLabel")
  62.     playingtext.Parent = serverframe
  63.     playingtext.Size = UDim2.new(.5,0,.5,0)
  64.     playingtext.BackgroundColor3 = Color3.fromRGB(60,60,60)
  65.     playingtext.BorderColor3 = Color3.fromRGB(255,255,255)
  66.     playingtext.TextColor3 = Color3.fromRGB(255,255,255)
  67.     playingtext.TextScaled = true
  68.     playingtext.Text = "Playing: "..tostring(playing)..max
  69.     local idtext = Instance.new("TextLabel")
  70.     idtext.Parent = serverframe
  71.     idtext.Size = UDim2.new(1,0,.5,0)
  72.     idtext.Position = UDim2.new(0,0,.5,0)
  73.     idtext.BackgroundColor3 = Color3.fromRGB(60,60,60)
  74.     idtext.BorderColor3 = Color3.fromRGB(255,255,255)
  75.     idtext.TextColor3 = Color3.fromRGB(255,255,255)
  76.     idtext.TextScaled = true
  77.     idtext.Text = tostring(serverid)
  78.     mainframe.CanvasSize = UDim2.new(0,0,(#mainframe:GetChildren()-1)*.0705,10)
  79. end
  80. function updatestorage()
  81.     serverstorage = httpservice:JSONDecode(request({Url = string.format("https://games.roblox.com/v1/games/%d/servers/Public?sortOrder=Desc&limit=100", game.PlaceId)}).Body).data
  82.     for i,v in pairs(mainframe:GetChildren()) do
  83.         if v:IsA("Frame") then
  84.             v:Destroy()
  85.         end
  86.     end
  87.     for i,v in pairs(serverstorage) do
  88.         if type(v) == "table" and v.id and v.maxPlayers and v.playing then
  89.             if tonumber(v.playing) == tonumber(v.maxPlayers) then
  90.                 if v.id == game.JobId then
  91.                     createserver(v.id,v.playing," (max + your server)")
  92.                 else
  93.                     createserver(v.id,v.playing," (max)")
  94.                 end
  95.             elseif tonumber(v.playing) < tonumber(v.maxPlayers) then
  96.                 if v.id == game.JobId then
  97.                     createserver(v.id,v.playing," (your server)")
  98.                 else
  99.                     createserver(v.id,v.playing,"")
  100.                 end
  101.             end
  102.         end
  103.     end
  104. end
  105. while destroyed == false do
  106.     wait(.1)
  107.     updatestorage()
  108. end
  109. a:Disconnect()
  110. for i,v in pairs(joinfuncs) do
  111.     v:Disconnect()
  112. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement