Back to Scripts
Unban New Server
ScriptBlox
Verified
Free
Game: Prison Life
301
Views
0
Likes
0
Dislikes
Tomato
offline
Features
When Banned from a server unbans you by putting you in a new server.
Tags
Script Code
--[[
================================================================================
== ROBLOX AUTO-JOIN LOWEST PING SERVER SCRIPT ==
================================================================================
Description:
This script automatically finds the public server with the lowest ping for the
current game and teleports the player to it. It maintains a local file
("ServerHop.txt") to keep track of recently joined servers to avoid
re-joining the same one within an hour.
Requirements:
This script must be run in a Roblox script executor that supports the
following non-standard file I/O functions:
- isfile(path)
- readfile(path)
- writefile(path, content)
Execution:
When run, the script will immediately start the server-finding process.
]]
-- Define the main function for server hopping
function JoinLowestPingServer()
-- Configuration
local IGNORE_FILE = "ServerHop.txt" -- The name of the file to store recently visited server IDs.
local HOUR = 3600 -- The duration in seconds (1 hour) to ignore a server after visiting.
-- Roblox Services
local HttpService = game:GetService("HttpService")
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
---
-- Reads the ignore file and returns a table of servers that were visited
-- within the last hour.
-- @return {table} A dictionary where keys are server IDs and values are timestamps.
---
local function getIgnoredServers()
if not isfile(IGNORE_FILE) then
return {}
end
local ignored = {}
local currentTime = os.time()
-- Safely read the file content
local success, fileContent = pcall(readfile, IGNORE_FILE)
if not success or not fileContent then
warn("Could not read the ignore file.")
return {}
end
-- Process each line in the file
for _, line in ipairs(fileContent:split("\n")) do
local serverId, timestampStr = line:match("([^|]+)|?(%d*)")
local timestamp = tonumber(timestampStr)
if serverId and timestamp and (currentTime - timestamp < HOUR) then
ignored[serverId] = timestamp
end
end
return ignored
end
---
-- Writes the updated list of ignored servers back to the file.
-- @param servers {table} The table of server IDs and timestamps to write.
---
local function updateIgnoredServers(servers)
local lines = {}
for id, time in pairs(servers) do
table.insert(lines, id .. "|" .. tostring(time))
end
-- Safely write to the file
pcall(writefile, IGNORE_FILE, table.concat(lines, "\n"))
end
-- Main logic execution starts here
local ignoredServers = getIgnoredServers()
local cursor = ""
local localPlayer = Players.LocalPlayer
-- Loop through pages of servers until a suitable one is found
while true do
local requestUrl = string.format(
"https://games.roblox.com/v1/games/%d/servers/Public?limit=100&sortOrder=Asc&cursor=%s",
game.PlaceId,
cursor
)
-- Make the web request within a protected call to handle potential errors
local success, result = pcall(function()
local response = game:HttpGet(requestUrl)
return HttpService:JSONDecode(response)
end)
if not success or not result or not result.data then
warn("Failed to fetch or decode the server list. The script will now terminate.")
return -- Exit the function if the API call fails
end
local serverList = result.data
-- Sort the server list by ping in ascending order
table.sort(serverList, function(a, b)
return a.ping < b.ping
end)
-- Iterate through the sorted list to find the best server
for _, server in ipairs(serverList) do
-- Check if the server is not in our recently visited list
if not ignoredServers[server.id] then
print(string.format("Found best server! ID: %s, Ping: %d. Attempting to teleport...", server.id, server.ping))
-- Add the server to the ignore list and update the file
ignoredServers[server.id] = os.time()
updateIgnoredServers(ignoredServers)
-- Teleport the player
local teleportSuccess, teleportError = pcall(function()
TeleportService:TeleportToPlaceInstance(game.PlaceId, server.id, localPlayer)
end)
if not teleportSuccess then
warn("Teleport failed:", teleportError)
end
return -- Exit the function after attempting to teleport
end
end
-- If no suitable server was found on this page, check for a next page
if not result.nextPageCursor then
warn("Scanned all available servers. No new servers found to join.")
break -- Exit the loop if there are no more pages
end
-- Move to the next page of results
cursor = result.nextPageCursor
print("No suitable server on this page, moving to the next...")
task.wait(0.5) -- Small delay to avoid rate-limiting
end
end
-- ================================================================================
-- == SCRIPT EXECUTION ==
-- ================================================================================
-- Call the function to start the server hopping process immediately
game:GetService("CoreGui").DescendantAdded:Connect(function(Descendant)
if Descendant.Name == "ErrorPrompt" then
print("Teleported", TeleportCount, "times before getting kicked.")
TeleportTest = nil
print("Initiating server hop to the lowest ping server...")
JoinLowestPingServer()
end
end)
Comments (0)
Please login to comment
Login with Discord
Loading comments...