MaxproGlitcher

Server Hop Test

May 18th, 2025
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. local IGNORE_FILE = "ServerHop.txt"
  2. local HOUR = 3600
  3.  
  4. local Module = {}
  5.  
  6. local HttpService, TeleportService = game:GetService"HttpService", game:GetService"TeleportService"
  7.  
  8. local function GET()
  9. if not isfile(IGNORE_FILE) then return {} end
  10. local list = {}
  11. local now = os.time()
  12. for _, line in next, readfile(IGNORE_FILE):split("\n") do
  13. local pmo, ts = line:match("([^|]+)|?(%d*)")
  14. ts = tonumber(ts) or 0
  15. if now - ts < HOUR then list[pmo] = ts end
  16. end
  17. return list
  18. end
  19.  
  20. local function Update(List)
  21. local sybau = {}
  22. for ts, pmo in next, List do
  23. table.insert(sybau, ts .. "|" .. pmo)
  24. end
  25. writefile(IGNORE_FILE, table.concat(sybau, "\n"))
  26. end
  27.  
  28. local IgnoredServers = GET()
  29.  
  30. function Module:GetServers(Sort)
  31. Sort = Sort or { ping = true, fps = false, asc = false }
  32.  
  33. local cursor = ""
  34. while true do
  35. local success, result = pcall(function()
  36. return HttpService:JSONDecode(game:HttpGet(`https://games.roblox.com/v1/games/{game.PlaceId}/servers/Public?limit=100&sortOrder={(Sort.asc and "Asc" or "Desc")}&excludeFullGames=true&cursor={cursor}`))
  37. end)
  38.  
  39. if not success or not result or not result.data then error("server error (not success or no result or no data)") end
  40.  
  41. local ServersList = result.data
  42.  
  43. table.sort(ServersList, function(a, b)
  44. if Sort.ping and Sort.fps then
  45. return a.ping == b.ping and a.fps > b.fps or a.ping < b.ping
  46. elseif Sort.ping then
  47. return a.ping < b.ping
  48. elseif Sort.fps then
  49. return a.fps > b.fps
  50. end
  51. end)
  52.  
  53. for _, Server in next, ServersList do
  54. if not IgnoredServers[Server.id] then
  55. IgnoredServers[Server.id] = os.time()
  56. Update(IgnoredServers)
  57.  
  58. return TeleportService:TeleportToPlaceInstance(game.PlaceId, Server.id, game:GetService("Players").LocalPlayer)
  59. end
  60. end
  61.  
  62. assert(result.nextPageCursor, "No server found.")
  63.  
  64. cursor = result.nextPageCursor
  65. end
  66. end
  67.  
  68. return Module
Advertisement
Add Comment
Please, Sign In to add comment