forked from zzerexx/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLowestPing.lua
More file actions
28 lines (26 loc) · 1001 Bytes
/
LowestPing.lua
File metadata and controls
28 lines (26 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
local PlaceId = 286090429
local lowestplayercount = 14
local http = game:GetService("HttpService")
local cursor = ""
local server
local lowestping = math.huge
function getservers(a)
local api = http:JSONDecode(game:HttpGet(a))
for i,v in pairs(api.data) do
if v.ping < lowestping and v.playing >= lowestplayercount then
server = v
end
end
if tostring(api.nextPageCursor) ~= "nil" then
getservers("https://games.roblox.com/v1/games/"..PlaceId.."/servers/Public?sortOrder=Asc&limit=100&cursor="..api.nextPageCursor)
else
print("Successfully searched all servers.")
print("Best Server: "..server.id)
print("Players: "..server.playing)
print("Ping: "..server.ping)
print("Fps: "..server.fps)
wait(2)
game:GetService("TeleportService"):TeleportToPlaceInstance(PlaceId,server.id)
end
end
getservers("https://games.roblox.com/v1/games/"..PlaceId.."/servers/Public?sortOrder=Asc&limit=100")