This function teleports a
Player to the place instance associated with the given placeId and instanceId. It can only be used to teleport to places in the same game.
The placeId is the
DataModel/PlaceId of the server and the instanceId is the
This function can not be used to teleport
Player|Players to servers created using
TeleportService/ReserveServer (reserved servers). For this, see
An optional spawnName parameter can be provided, which will cause the
Player to initially spawn at the
SpawnLocation of that name in the destination place. The
SpawnLocation must be valid for the
Player to spawn on. For example, it must be
SpawnLocation/Neutral|neutral or set to the same
SpawnLocation/TeamColor|TeamColor as the
Player will be assigned to upon joining the game.
A teleportData parameter can be specified. This is data the client will transmit to the destination place and can be retrieved using
The teleportData can take any of the following forms:
- A table without mixed keys (all keys are strings or integers)
- A string
- A number
- A bool
As the teleportData is transmitted by the client it is not secure. For this reason it should only be used for local settings and not sensitive items (such as the users’ score or in-game currency).
If you need teleport data to persist across multiple teleports, you can use
A customLoadingScreen argument can be specified. This is a
ScreenGui that is copied (without scripts) into the
CoreGui of the destination place.
TeleportService/SetTeleportGui is the preferred alternative to the customLoadingScreen argument as it can be called prior to the teleport.
ScreenGui can be obtained in the destination place using
TeleportService/GetArrivingTeleportGui, where developers can parent it to the
In some circumstances a teleport may fail. This can be due to the developer configuring the teleport incorrectly or issues with Roblox’s servers.
- If a teleportation request is rejected the
TeleportService/TeleportInitFailedevent will fire the error message and a
Enum/TeleportResultenumerator describing the issue
- Teleports can fail ‘in transit’, after the user has left the server, due to issues with Roblox’s servers. In this case the user will be shown an error message and be required to rejoin the game
- For more information on how to teleport players, see the
Articles/Teleporting Between Placestutorial.
The ID of the place to teleport to
Optional name of the
Optional data to be passed to the destination place. Can be retrieved using
Optional custom loading screen to be placed in the
Following Another Player
The code sample below, when placed inside a
ServerScriptService, will teleport a player who’s following another player to the associated place/server. Note that this will not work if the player being followed is in a reserved server.
local TeleportService = game:GetService("TeleportService") local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) -- Is this player following anyone? local followId = player.FollowUserId -- If so, find out where they are if followId and followId ~= 0 then local success, errorMessage, placeId, jobId = pcall(function() return TeleportService:GetPlayerPlaceInstanceAsync(followId) end) if success then -- Teleport player TeleportService:TeleportToPlaceInstance(placeId, jobId, player) end else warn("Player " .. player.UserId .. " is not following another player!") end end)