• 🌙 Community Spirit

    Ramadan Mubarak! To honor this month, Crax has paused NSFW categories. Wishing you peace and growth!

JOIN THE BEST PING SERVER SCRIPT - ROBLOX (1 Viewer)

Currently reading:
 JOIN THE BEST PING SERVER SCRIPT - ROBLOX (1 Viewer)

Recently searched:

revy_06

Member
LV
1
Joined
Aug 18, 2023
Threads
10
Likes
1
Awards
4
Credits
1,027©
Cash
0$
local HTTPService = game:GetService("HttpService")
local TeleportService = game:GetService("TeleportService")
local StatsService = game:GetService("Stats")

local function fetchServersData(placeId, limit)
local url = string.format("https://games.roblox.com/v1/games/%d/servers/Public?limit=%d", placeId, limit)
local success, response = pcall(function()
return HTTPService:JSONDecode(game:HttpGet(url))
end)

if success and response and response.data then
return response.data
end

return nil
end

local placeId = game.PlaceId
local serverLimit = 100
local servers = fetchServersData(placeId, serverLimit)

if not servers then
return
end

local lowestPingServer = servers[1]

for _, server in pairs(servers) do
if server["ping"] < lowestPingServer["ping"] then
lowestPingServer = server
end
end

local commonLoadTime = 5
task.wait(commonLoadTime)

local pingThreshold = 100
local serverStats = StatsService.Network.ServerStatsItem
local dataPing = serverStats["Data Ping"]:GetValueString()
local pingValue = tonumber(dataPing:match("(%d+)"))

if pingValue >= pingThreshold then
TeleportService:TeleportToPlaceInstance(placeId, lowestPingServer.id)
else
-- Good ping
end

RRRRR
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Tips
Recently searched:

Similar threads

Users who are viewing this thread

Top Bottom