How to teleport in roblox studio

5 min

Teleporting a player’s character to a different coordinate point — while maintaining the character’s structural makeup — is achieved by moving the character’s Humanoid/RootPart|RootPart. This article outlines a module-based approach with adjustable parameters.

This article focuses on moving players within the same articles/games and places|place. To teleport players between places/levels in a multi-place game, see articles/Teleporting Between Places|Teleporting Between Places.

Basic teleport functionality can be wrapped in a ModuleScript so that it can be called from other scripts.

  1. Create a new ModuleScript within ReplicatedStorage and rename it TeleportWithinPlace.
How to teleport in roblox studio
  1. Copy and paste in the following code:

Teleportation can be easily triggered when a player touches a part such as a teleporation pad or an invisible trigger part at a door’s entry point.

  1. Include the Teleport Module in your project.
  2. Attach a Script to an anchored BasePart and paste in the code below.

  1. Adjust the variable values on lines 5–7 as desired:
Variable Description
TELEPORT_DESTINATION The datatype/Vector3 position to teleport the player to.
TELEPORT_FACE_ANGLE Angular direction character should face following teleportation, between -180 and 180.
FREEZE_CHARACTER Whether to temporarily "freeze" the character during teleportation, preventing movement or jumping.

Because player teleportation should only be called on the game server, you’ll need to fire a articles/Remote Functions and Events|remote event alongside client-side actions like activation of a GUI button. The following setup outlines this process.

  1. Make sure you’ve included the Teleport Module in your project.
  2. Add a new Script to ServerScriptService and paste in the code below — this gets the remote event created by the teleport module and, upon an RemoteEvent/OnServerEvent|OnServerEvent connection, finds the Humanoid associated with the player and calls the module’s Teleport function.

  1. Attach a LocalScript to a TextButton or ImageButton and paste in the following code:

  1. Adjust the variable values on lines 5–7 as desired:
Variable Description
TELEPORT_DESTINATION The datatype/Vector3 position to teleport the player to.
TELEPORT_FACE_ANGLE Angular direction character should face following teleportation, between -180 and 180.
FREEZE_CHARACTER Whether to temporarily "freeze" the character during teleportation, preventing movement or jumping.

Tags: