K1ngBlitzy

Untitled

Aug 20th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. local PlaceID = game.PlaceId
  2. local AllIDs = {}
  3. local foundAnything = ""
  4. local actualHour = os.date("!*t").hour
  5. local Deleted = false
  6. local File = pcall(function()
  7. AllIDs = game:GetService('HttpService'):JSONDecode(readfile("NotSameServers.json"))
  8. end)
  9. if not File then
  10. table.insert(AllIDs, actualHour)
  11. writefile("NotSameServers.json", game:GetService('HttpService'):JSONEncode(AllIDs))
  12. end
  13. function TPReturner()
  14. local Site;
  15. if foundAnything == "" then
  16. Site = game.HttpService:JSONDecode(game:HttpGet('https://games.roblox.com/v1/games/' .. PlaceID .. '/servers/Public?sortOrder=Asc&limit=100'))
  17. else
  18. Site = game.HttpService:JSONDecode(game:HttpGet('https://games.roblox.com/v1/games/' .. PlaceID .. '/servers/Public?sortOrder=Asc&limit=100&cursor=' .. foundAnything))
  19. end
  20. local ID = ""
  21. if Site.nextPageCursor and Site.nextPageCursor ~= "null" and Site.nextPageCursor ~= nil then
  22. foundAnything = Site.nextPageCursor
  23. end
  24. local num = 0;
  25. for i,v in pairs(Site.data) do
  26. local Possible = true
  27. ID = tostring(v.id)
  28. if tonumber(v.maxPlayers) > tonumber(v.playing) then
  29. for _,Existing in pairs(AllIDs) do
  30. if num ~= 0 then
  31. if ID == tostring(Existing) then
  32. Possible = false
  33. end
  34. else
  35. if tonumber(actualHour) ~= tonumber(Existing) then
  36. local delFile = pcall(function()
  37. delfile("NotSameServers.json")
  38. AllIDs = {}
  39. table.insert(AllIDs, actualHour)
  40. end)
  41. end
  42. end
  43. num = num + 1
  44. end
  45. if Possible == true then
  46. table.insert(AllIDs, ID)
  47. wait()
  48. pcall(function()
  49. writefile("NotSameServers.json", game:GetService('HttpService'):JSONEncode(AllIDs))
  50. wait()
  51. game:GetService("TeleportService"):TeleportToPlaceInstance(PlaceID, ID, game.Players.LocalPlayer)
  52. end)
  53. wait(4)
  54. end
  55. end
  56. end
  57. end
  58.  
  59. function Teleport()
  60. while wait() do
  61. pcall(function()
  62. TPReturner()
  63. if foundAnything ~= "" then
  64. TPReturner()
  65. end
  66. end)
  67. end
  68. end
  69.  
  70. -- If you'd like to use a script before server hopping (Like a Automatic Chest collector you can put the Teleport() after it collected everything.
  71. Teleport()
Add Comment
Please, Sign In to add comment