Teleporting to a specific server in a game

Hello there!, I’m Steve,

  1. What do you want to achieve? I want to make it so I can teleport players to a specific server using a server id (Games API server id) (example of a server id: d464ef2d-3685-41f3-8fc9-6e2b5136898e)

  2. What is the issue? I do not know how to do so, Although I have tried using TeleportToPrivateServer, It says the player is teleporting while the player isn’t?

Here’s how my code looks like (cut out a bit of it)

local game_id = 0000000
local server = {id = "server-id-here"}
local players = {game.Players.MyPlayer}
			
pcall(function()
	TS:TeleportToPrivateServer(game_id, server.id, players)
end)
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?: I have tried the solution above …/, Yes, but it was for only my game/experience/place/universe (reserved servers).

Any help would be appreciated, :slight_smile:

(API website: https://games.roblox.com/docs#!/Games/get_v1_games_placeId_servers_serverType)

TS:TeleportToPrivateServer can only be used if there is a reserved server first.
So basically you would have to make a variable for the Reserved server

local ReservedServer = TS:ReserveServer(game_id)
TS:TeleportToPrivateServer(game_id, ReservedServer, players)

1 Like

but I want to teleport players to a specific server and doing this will make a new server, which will not work.

Are you talking about like a separate server but still within the same game type of thing?
If that’s the case then it would probably be using TS:TeleportToPlaceInstance(game_id, server.id, players) instead.

3 Likes

Hey, I get this error while trying to teleport, Any idea on how to fix it? “Unable to cast value to Object”

Oh that may be an array thing, I think that TeleportToPlaceInstance only takes 1 player instead of a table of players so you might have to do a for loop for all the players within the tables. I’m not too sure about it myself though.

1 Like