What does LookVector mean?

So I made a knockback script for my fighting game, but however, instead of going back, the enemy keeps on going front.

Essentially, the LookVector of a part is the forward-facing direction of it. If you want your enemy to go backwards, make them go the direction which is negative of the LookVector.

I would like to know what you’ve done so far, just having a few words without any code shown doesn’t help solve your issue, but here are some things you can try.
If you are multiplying the enemy’s cframe to make them get knocked back, what if you just made the z of the cframe you’re multiplying to the enemy’s cframe negative?
If not, you can just reverse the lookvector by doing - LookVector

Or you can just negate it; __unm is implemented.

local cf = CFrame.new()
print(-cf.LookVector)

In a really “easy” way to understand it:

LookVector is an vector unit that points to the direction the part is looking at.

As I said it is a unit, therefore its magnitude is 1.

You can do -LookVector to get the back vector. (The same to the others)

Examples for the others:

(-RightVector) = LeftVector
(-UpVector) = DownVector
(-LookVector) = BackVector

(Note that left vector, down vector, back vector arent defined in lua therefore you will have to use that method if you want to get any of them)

2 Likes