To make a teleporter in Roblox, start by opening Roblox Studio and creating two parts named `Pad1` and `Pad2`. Make sure to set their size to 4x1x4 and assign different colors to them. This helps in distinguishing the pads.
Next, insert a script into `Pad1`. Create a variable to hold the path to `Pad2` by adding `local Pad = game.Workspace.Pad2` in the script. This links the two pads together.
Then, set up a `Touched` event to trigger when a player touches the pad. Use the following code to check if the object touching the pad is a player’s character and teleport them:
lua
script.Parent.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
Player.Character.HumanoidRootPart.CFrame = Pad.CFrame + Vector3.new(0, 5, 0)
wait(3) — Add a cooldown to prevent instant re-teleportation
end
end)
Copy this script from `Pad1` and paste it into `Pad2`. Update the `Pad` variable in `Pad2`’s script to reference `Pad1` instead. This completes the link between the two pads.
Finally, test the teleporter by running the game and walking over the pads. If it doesn’t work, check the output window for error messages. This basic teleporter script allows players to teleport between the two pads, and you can enhance it with additional features later.