Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How does lookvector work and how to use it?

I looked on devforum and it didn't have what i am trying to do. idk if lookvector is the right thing to use but i am trying to make something similar to SCP 173. could someone explain how lookvector works?

1 answer

✓ Accepted answer

Look/Up/Right Vectors describe the direction of the Front/Top/Right faces.

-- Preferred way
-- moves it forward 5 studs (relative to it's orientation), forward is NEGATIVE on the Z-plane
part.CFrame = part.CFrame * CFrame.new(0, 0, -5) 

-- Way using lookVector
-- If facing straight forward, lv is <0, 0, -1>
local cf = part.CFrame
local lv = cf.lookVector
part.CFrame = cf + (lv * Vector3.new(5, 5, 5))

This discussion is preserved as it was. New answers, comments, and votes are closed.