Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Http=game:GetService("HttpService")
- Player=game:GetService("Players").LocalPlayer
- T=game:GetService("TeleportService")
- local placeId=game.PlaceId
- local MaxPing=90
- local function GetCollection()
- local json=Http:JSONDecode(game:HttpGet("https://www.roblox.com/games/getgameinstancesjson?placeId="..placeId.."&startIndex=0"))
- return #json["Collection"]
- end
- local function GetServers()
- local servers={}
- for i=0,GetCollection() do
- local json=Http:JSONDecode(game:HttpGet("https://www.roblox.com/games/getgameinstancesjson?placeId="..placeId.."&startIndex="..tostring(i)))
- local collection=json["Collection"]
- for _,server in pairs(collection) do
- local Ping=server["Ping"]
- local MaxPlayers=server["Capacity"]
- local CurrentPlayers=server["CurrentPlayers"]
- if #CurrentPlayers<MaxPlayers and Ping<=MaxPing then
- table.insert(servers,server)
- end
- end
- end
- return servers
- end
- T:TeleportToPlaceInstance(placeId,GetServers()[1].Guid)
Add Comment
Please, Sign In to add comment