Advertisement
IComeForScript

Server Hop | Magma Hub Method

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