How would I teleport a part relative to its orientation?

So I want to teleport an object, but instead of teleporting it to a specific position or relative to itself, I want to teleport it like 5 studs in front of itself. I’m very new to cframes and teleporting though

All you would do is get the crame of the part and then add onto it using its lookvector

local part = pathtopart
part.CFrame = part.CFrame * part.CFrame.LookVector * STUDS

This will keep its rotation into account also since CFrame is rotation and also position

1 Like

This is covered in Alvinbloxes tutorial look vector section 36:50, same thing as @dexanddeb mentioned.

Should be through addition since the direction vector we are moving the part CFrame is relative to world space.

part.CFrame = part.CFrame + part.CFrame.LookVector * STUDS
1 Like

uhh hmm, I implemented your code, but it’s not moving at all. I put the local part correctly and the studs to 5, but it isnt moving

LookVectors are Vector3s, and you can’t multiply Vector3s by CFrames. Changing a part’s position doesn’t modify it’s orientation though, so it’s safe to do this:

part.Position += part.CFrame.LookVector * STUDS
1 Like

Oh wow! its works perfectly thanks!