I've been thinking about a teleport script to teleport 10 studs to where the player was facing, but couldn't figure out how I would do it. I tried:
local orientation = character.Torso.Orientation character.HumanoidRootPart.Position = CFrame.new(character.Humanoid.RootPart.Position + 10, 0, 0)
but then I realized that it would teleport the player only in the X axis, and I don't know how to get the direction they are facing. I'm kinda new to this kinda stuff so I don't know what I'm doing.
You should use CFrame.LookVector. LookVector is the forward-facing direction of a CFrame, or basically the front of a BasePart. (in your terms)
local humanoidRootPart = character.HumanoidRootPart humanoidRootPart.CFrame = humanoidRootPart.CFrame + humanoidRootPart.CFrame.LookVector * 10 -- teleport the player 10 studs forward
function onTouch(part) if part.Parent.Humanoid ~=nil then part.Parent:MoveTo(script.Parent.Parent.Tele2.Position) end end script.Parent.Touched:connect(onTouch)
assuming you place a second part 10 studs right a head of the touched part. However, the direction of player when facing the part will till determine the direction facing when arriving on "Tele2".