API:Class/TeleportService/Teleport

Teleport

Function of ExplorerImageIndex70.pngTeleportService
void Teleport (
    int64 placeId,
    Player player = nil,
    Variant teleportData,
    ScreenGui customLoadingScreen = nil
)
Parameters:
  1. placeId
  2. player
  3. teleportData
  4. customLoadingScreen

Returns: void
Description: Used to teleport a player to the place with ID placeId. The given teleportData can be any value that can be stored in a datastore, and will be transported along with the player. The customLoadingScreen is a GUI that'll be made static (scripts don't run, TweenPosition etc doesn't work, ...) and displayed during teleporting. You can see these arguments after the player has been teleported, using LocalPlayerArrivedFromTeleport.

Notes

  • The teleportData parameter can be excluded, as Variants can be nil.

Example

The code below will teleport a player to Crossroads, assuming it's in a LocalScript.

game:GetService('TeleportService'):Teleport(1818)

The code below will teleport a player to Crossroads, from a server side Script. This assumes that there's a player named 'Telamon' present.

game:GetService('TeleportService'):Teleport(1818, game.Players.Telamon)

Tutorials Used In