So I’m making a game and I want to teleport the players to another server. I can kind of do this but it get an error message if i do it like 5 times in a row.
I have tried 2 different ways of doing it but they still have the same problem
Script 1:
local URL = ("https://www.roblox.com/games/getgameinstancesjson?placeId="..game.PlaceId.."&startindex=")
local a = game:HttpGet(URL.."0")
local b = game:GetService("HttpService"):JSONDecode(a)
local function ServerHop()
for i,v in pairs(b.Collection) do
if v.UserCanJoin == true then
game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, v.Guid)
end
end
end
ServerHop()
Script 2:
local servers = game:GetService("HttpService"):JSONDecode(game:HttpGet("https://games.roblox.com/v1/games/".. game.PlaceId.. "/servers/Public?sortOrder=Asc&limit=100"))
local function ServerHop()
for i,v in pairs(servers.data) do
if v.playing ~= v.maxPlayers and v.playerIds ~= game:GetService("Players").LocalPlayer.UserId then
game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, v.id)
end
end
end
ServerHop()
Is there any way to get all the servers of a game, not just 100 (or some number that isn’t all of them)? If there is an api link for that or something that would really help :)

2 comments
I would use MessagingService to do that
I dont know how to use messagingservice lol