R

shop

public
rrixh Apr 09, 2024 Never 97
Clone
Lua serverHop_.deb 23 lines (20 loc) | 799 Bytes
1
local Player = game.Players.LocalPlayer
2
local Http = game:GetService("HttpService")
3
local TPS = game:GetService("TeleportService")
4
local Api = "https://games.roblox.com/v1/games/"
5
6
local _place,_id = game.PlaceId, game.JobId
7
local _servers = Api.._place.."/servers/Public?sortOrder=Desc&limit=100"
8
function ListServers(cursor)
9
local Raw = game:HttpGet(_servers .. ((cursor and "&cursor="..cursor) or ""))
10
return Http:JSONDecode(Raw)
11
end
12
13
local Next; repeat
14
local Servers = ListServers(Next)
15
for i,v in next, Servers.data do
16
if v.playing < v.maxPlayers and v.id ~= _id then
17
local s,r = pcall(TPS.TeleportToPlaceInstance,TPS,_place,v.id,Player)
18
if s then break end
19
end
20
end
21
22
Next = Servers.nextPageCursor
23
until not Next