How do I point a Vector3 towards a location?

I would like to give a starting position and an end position and create a Vector3 that will point to the end position from the starting position.

I’m not very good at vector math, and can’t figure it out

I have tried creating a CFrame that points to the location and getting it’s LookVector, however that A. didn’t point in the right direction and B. the Y value was huge for some reason

A Vector3 does not have an orientation. If you mean that you would like to create a CFrame (which consists of both a translational and rotational component) centered at the starting position facing the target position, then the following snippet demonstrates a way to do this:

local eye = Vector3.new(0, 5, 0) -- starting position
local targetPosition = eye + Vector3.new(1, 1, 1) -- target position
local lookAtCFrame = CFrame.lookAt(eye, targetPosition)

I mean like if I would like to create a Vector3 that if I moved a part along it starting at the start position it would move towards the end position

Maybe something like this:

local directionVector = position2 - position1
print(position1 + directionVector) -- will return position2

I’m not really sure what you want.

A vector does have a direction though(From an origin point). You can multiply vectors by integers which I believe is what partly linear interpolation is.

It does have a direction and a magnitude, but when I said orientation, I was referring to the actual angular rotation in space.

You can interpolate the start position to the end position with the “Lerp” method and then make your part face the end position using the lookAt constructor shown.

https://gyazo.com/428e537f8bfc4f2e880a39463147481d

I believe you don’t actually need to make a CFrame you can just minus the originvector by the endvector which will make the endvector relative to the originvector and from there on you can lerp.

You are correct, though I wasn’t too sure if they wanted the object to face its target as it was moving.

To get the direction, just subtract them.
For example:

local startPos = Vector3.new(0, 1, 0)
local endPos = Vector3.new(0, 1, 5)
local direction = endPos - startPos
print(direction) -- prints 0, 0, 5

can’t believe i didn’t think of this lol

im not the best at math