Teleporting player from one server to another

I want to have a command that allows me to “Hop” from one server to another server. For example I will call this in a localscript

local TeleportService = game:GetService("TeleportService")
TeleportService:Teleport(placeid)

but it puts me back in the same server. How can I get it so it teleports me to a random server not the same server?

I think it has something to do with job id

please help!

1 Like

Look at these two documents:
https://developer.roblox.com/en-us/api-reference/function/TeleportService/TeleportToPlaceInstance
https://games.roblox.com/docs#!/Games/get_v1_games_placeId_servers_serverType

I do not know how to use api’s like that though would you be able to give an example??? I looked at the first link but I did not understand it very much.

Ok I have gotten it working but the problem is it only shows the servers that would be on page 1.

I have a function to get a random jobid but there is a high likleyhood that it will pick the same ones because it is only choosing from about 10 or so as that is how many there would be on page 1 of the server list.

local GetRandomJobId = function()
	local JSONDecode = HttpService:JSONDecode(Response.Body)
	return JSONDecode.data[math.random(1, table.getn(JSONDecode.data))].id
end

How do I fix this as to so it picks from every single running server?

I just checked the API. Apparently, you can select the amount of servers you want to query, but the choices are only 10 (default), 25, 50, and 100. Hopefully 100 servers would be enough for you.

Examples:
https://games.roblox.com/v1/games/920587237/servers/Public?sortOrder=Asc&limit=10 (queries 10 servers maximum)
https://games.roblox.com/v1/games/920587237/servers/Public?sortOrder=Asc&limit=100 (queries 100 servers maximum)

100 is not quite enough, is there a way I can get more than 100 servers?

Sorry for the late response. Don’t know if you still need it, but check this out: