Make line between two vector points

I want to create a line between two vector points. For example:

image


I want it to adapt so that if one vector point is (15,30,23) and the other is is (0,0,0) the line adapts so it goes up and diagonal.

Math and CFrame

local A = Vector3.new(0, 0, 0)       -- Start
local B = Vector3.new(15, 30, 23)    -- End
local Part = workspace.TestPart      -- Line

Part.CFrame = CFrame.lookAt((A + B)/2, A) * CFrame.Angles(0, math.pi/2, 0)
Part.Size = Vector3.new((B - A).Magnitude, 1, 1)
1 Like

What should I put for the variable Start?

The starting point, Start and End are the limits of the line

If it solved your problem, mark it as solved.

1 Like

Wow, it works perfectly!

Sorry for not marking this as solution before, since I was busy testing it out!

1 Like