So, in order to understand these shenanigins we will take a deep look into CFrame.
First of all, a lookVector is just a unit vector (unit vector are just vectors with the length of one,
or you can say magnitude which is the same as length, and they have a length of one because they are used just to describe a direction, since vectors are lines that have a magnitude (length) and direction, so if their magnitude is 1 we wouldnt care about it so we'll be using this unit vector just to describe a direction), and this unit vector which I said is just to describe a direction is used to describe the direction of where the object is looking, the looking direction,
that's why its called a lookvector.
Now, I hope that was clear, but I'm sure you are asking "why the heck did we do this in the script?"
print(CFrame.new(part.Position, mouse.Hit.Position).lookVector)
Welp, because the cframe has components
print(CFrame.new():Components()
You can see that it

These are the components of a CFrame, the numbers or in a right way the vectors that construct a cframe. Now if you didn't know, CFrame is position and rotation, and is made up of 4 vectors, the Position vector for the position, and the lookVector, rightVector and upVector, these three being for rotation.
An image that might make this simple

You can see the position vector, which actually has a magnitude of 0, because its just a point, but vectors can be replaced with a point. And the three other vectors (btw backVector is the same as lookVector) represeting a rotation by rotating each one of them invidually.
And a CFrame is actually a 4x4 Matrix, containing these vectors (a matrix is some sort of thing that holds numbers) like
.
But this is probarly complicated as crap, so an easier way to break it down is like
.
Like that, those are the components of a CFrame
So yeah, you can get these while you're scripting this way CFrame.ComponentName
local cframe = CFrame.new(part.Position, mouse.Hit.Position)
print(cframe.p)
print(cframe.rightVector)
print(cframe.upVector)
print(cframe.lookVector)
print(cframe.rightVector.magnitude)
And that is really all about CFrame, but a simplified version of it, there is way more to embark.
And in order to dig deeper you may need some knowledge on Linear Algebra so i would recommend this.
2 comments
Was not expecting an answer like this. Thank you for taking your time and describing this!
No problem! I love doing this