How to Create a Teleport on Roblox

By Matt Scheer

A massively multiplayer online construction environment, Roblox gives designers the tools to make interactive worlds and games for players. Many elements of world construction are natively built into the user interface of Roblox. Teleporters are not. But they are simple and easy to build for an expert and novice alike. They require some scripting in Roblox's scripting language, Lua. As with all other programming, you can build on the achievements of others: teleporters are common features of Roblox worlds, so there are already free-to-use scripts for Teleporters. Expect the whole process to take less than five minutes.

Open Roblox Studio.

Click on the "Insert" tab in the menu bar. Choose "Tools" from the list that appears. The tools panel should appear to the right of the world viewer.

Scroll through the category list on top of the tools panel. Look for Bricks. Click on any brick from the thumbnail of default bricks that appear in the tools panel. The brick should appear in the world viewer now.

Click on the brick in the world viewer. A properties panel should appear to the right of the tools panel. Highlight and delete the name for the object you've selected, which is the brick. Rename the brick anything you like, such as "teleporter."

Click on the brick in the world viewer again. Click on the "Insert" tab again in the menu bar. Select "Objects" this time. The objects window should appear. Select "Script" from the list of objects. Press "OK." This action should link a script tag to the properties of the brick.

Select the "Insert" tab once more. Click on "Explorer." An explorer panel should appear to the right of the tools panel. Double-click on the word "Script" below the brick in the explorer panel. A text area should appear where you can type in a script.

Type in this script into the text area:

-function onTouch(part)

local Toucher = part.Parent:FindFirstChild("Humanoid")

if Toucher -= nil then

Toucher.Torso.CFrame = CFrame.new ("0,0,1")

end

end

teleporter = script.Parent

teleporter.Touched:connect(OnTouch)

Press the "Explorer" tab. The script turns the brick into a teleporter. It does this by creating a condition that looks for whether something has touched the brick; if something has, it changes that thing's CFrame, which is the location variable that every element in Roblox automatically contains, to whatever location you want. Change the default coordinates "0,0,1" to whereever you want players to be teleported when they touch your teleporter. The first digit represents the X-axis, the Second is the z-axis, and the third is the Y-axis. And change the "teleporter" in the script to whatever you named your teleporter brick.

×