Start with the Parts

Create two pads. Name them Teleport1 and Teleport2. Make 1 Red and 2 Blue. Put 2 as the Child of 1 and make sure they are anchored.

Start the Script

Make a child script to Teleport1 and write this code

This assigns the Teleport pads. The game starts with it being TRUE that you can teleport. The functions are written to help you tell WHERE the player will teleport from and the destination. If you have lots of teleport pads, it will be useful to keep track of it this way. The last two lines then connect the teleport pads to their functions.


Coding a Teleport

Write the following code to make the teleports happen.

Important Things!

Notice that we were looking for HumanoidRootPart, not Humanoid. That’s because the HumanoidRootPart is what stores the position of your character.

CFrame is what stores the position(X,Y,Z) and orientation(rotation) of an object. Vector3 stores X,Y,Z. We will go over these more in the next activity.