How do i get the CFrame rotation along a beam using the CFrame rotation of the attachments

How do i get the rotation along a beam using the rotations of the attachments and the beam curve size



ive tried looking at How can I get a CFrame along a BEAM? but i dont know how they got the rotation and how to get the normal along the beam and i have already calculated the positions

this is the script currently

local function getPoints(beam:Beam):{Vector3}
	return{beam.Attachment0.WorldPosition,
		beam.Attachment0.WorldPosition+beam.Attachment0.WorldCFrame.RightVector*beam.CurveSize0,
		beam.Attachment1.WorldPosition-beam.Attachment1.WorldCFrame.XVector*beam.CurveSize1,
		beam.Attachment1.WorldPosition}
end
local function bezier(points:{Vector3},t:number):Vector3
	if#points==1 then
		return points[1]
	end
	local newPoints={}
	for i=1,#points-1 do
		newPoints[i]=points[i]:Lerp(points[i+1],t)
	end
	return bezier(newPoints,t)
end

no way we got bots on Help and Feedback now someone gotta stop this

i used something similar to this as the answer

CFrame.lookAt(
	bezier(getPoints(beam),t), -- position
	bezier(getPoints(beam),t+0.5/beam.Segments), -- position + tangent
	beam.Attachment0.WorldCFrame.UpVector:Lerp(beam.Attachment1.WorldCFrame.UpVector,t) -- normal
)