Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Players = cloneref(game:GetService("Players"))
- HttpService = cloneref(game:GetService("HttpService"))
- TeleportService = cloneref(game:GetService("TeleportService"))
- httprequest = (syn and syn.request) or (http and http.request) or http_request or (fluxus and fluxus.request) or request
- PlaceId, JobId = game.PlaceId, game.JobId
- if httprequest then
- local servers = {}
- local req = httprequest({Url = string.format("https://games.roblox.com/v1/games/%d/servers/Public?sortOrder=Desc&limit=100&excludeFullGames=true", PlaceId)})
- local body = HttpService:JSONDecode(req.Body)
- if body and body.data then
- for i, v in next, body.data do
- if type(v) == "table" and tonumber(v.playing) and tonumber(v.maxPlayers) and v.playing < v.maxPlayers and v.id ~= JobId then
- table.insert(servers, 1, v.id)
- end
- end
- end
- if #servers > 0 then
- TeleportService:TeleportToPlaceInstance(PlaceId, servers[math.random(1, #servers)], Players.LocalPlayer)
- else
- print("Serverhop, Couldn't find a server.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement