Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to teleport a player when it touches a part?

Asked by 3 years ago
local block = script.Parent
local plr = game:GetService("Players")

block.TouchEnded:Connect(function(player)
    local hum = player.Parent:FindFirstChild("Humanoid")
    wait()
    hum.CFrame = CFrame.new(0,0,0)
end)

Here's the script but I have no idea how to make the player teleport. Do I use the humanoid or the character?

1 answer

Log in to vote
1
Answered by
TudiPYM 12
3 years ago

Pretty use you gotta use the Humanoid root part, so it will look something like this:

local player = game.Players.LocalPlayer
local character = player.Character

if player.Character:FindFirstChild("HumanoidRootPart") then
    player.Character.HumanoidRootPart.CFrame = game.Workspace.{PARTNAME}.CFrame
end

Hope this helped!

Ad

Answer this question