Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cfg = getgenv().serverhopsettings or {
- PAGES = 4; --[[If the game is big change this]]
- MAX_PING = 125;
- }
- local function newserver()
- local rng = Random.new(os.clock())
- local plr = game:GetService("Players").LocalPlayer
- local servers = {}
- for _ = 1,100 do
- for _ = 1, cfg.PAGES do
- local decode = game:GetService("HttpService"):JSONDecode(game:HttpGetAsync("https://games.roblox.com/v1/games/"..game.PlaceId.."/servers/Public?sortOrder=Asc&limit=100&cursor="))
- if decode.nextPageCursor ~= nil then
- decode = game:GetService("HttpService"):JSONDecode(game:HttpGetAsync("https://games.roblox.com/v1/games/"..game.PlaceId.."/servers/Public?sortOrder=Asc&limit=100&cursor="..decode.nextPageCursor))
- for _,server in pairs(decode.data) do
- pcall(function()
- if server.maxPlayers - server.playing > 1 and server.ping <= cfg.MAX_PING then
- servers[#servers+1] = server.id
- end
- end)
- end
- else
- for _,server in pairs(decode.data) do
- pcall(function()
- if server.maxPlayers - server.playing > 1 and server.ping <= cfg.MAX_PING then
- servers[#servers+1] = server.id
- end
- end)
- end
- break
- end
- end
- pcall(function() game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, servers[rng:NextInteger(1,#servers)], plr) end)
- wait(8)
- end
- end
- spawn(function()
- while wait(0.1) do
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- for _, v in pairs(Players:GetChildren()) do
- local vChar = v.Character or nil if vChar then
- local func, result = pcall(function()
- local mag = (LocalPlayer.Character.HumanoidRootPart.Position - vChar.HumanoidRootPart.Position).Magnitude
- if mag < 2500 and mag ~= 0 --[[distance in studs]] then
- newserver()
- end
- end)
- end
- end
- end
- end)
Add Comment
Please, Sign In to add comment