Help with rotating part as it travels along a cubic curve

Hello I know this is a semi mathy question, however, every forum post I’ve tried to use for this hasn’t been able to accomplish my goals.

Goals: I want my model that has a primary part to rotate along with the bezier curve as it’s following the path.

Here’s my code:

function NukeModule:LaunchNuke(nuke)
	local PathFolder = workspace:WaitForChild("Path")
	local start = PathFolder:WaitForChild("Start").Position
	local finish = PathFolder:WaitForChild("End").Position
	local p1 = PathFolder:WaitForChild("p1").Position
	local p2 = PathFolder:WaitForChild("p2").Position

	local function lerp(a,b,t)
		return a + (b-a) * t
	end

	for i = 0, 500, 1 do
		local t = i/500
		
	
		local l1 = lerp(start, p1, t)
		local l2 = lerp(p1, p2, t)
		local l3 = lerp(p2, finish, t)

		local start = lerp(l1, l2, t)
		local finish = lerp(l2,l3,t)

		local cubic = lerp(start, finish,t)

		nuke:SetPrimaryPartCFrame(CFrame.new(cubic))
		task.wait(.01)
	end
end

Can’t you use that “T” as orientation ? (green line*)

Going to try that right now I believe I’ve tried something similar before

I was able to come up with this however I cannot get it to follow the curve anymore

nuke:SetPrimaryPartCFrame(CFrame.new(nuke.PrimaryPart.CFrame.Position, (1-t)^3 * start + 3 * (1-t)^2 * t * p1 + 3 * (1-t) * t^2 * p2 + t^3 * finish) * CFrame.Angles(math.pi/2,0,0))


function NukeModule:LaunchNuke(nuke)
	local PathFolder = workspace:WaitForChild("Path")
	local startP = PathFolder:WaitForChild("Start").Position
	local finishP = PathFolder:WaitForChild("End").Position
	local p1 = PathFolder:WaitForChild("p1").Position
	local p2 = PathFolder:WaitForChild("p2").Position

	local function lerp(a,b,t)
		return a + (b-a) * t
	end

	for i = 0, 500, 1 do
		local t = i/500
		local nextT = (i + 1)/500

		local l1 = lerp(startP, p1, t)
		local l2 = lerp(p1, p2, t)
		local l3 = lerp(p2, finishP, t)

		local start = lerp(l1, l2, t)
		local finish = lerp(l2,l3,t)

		local cubic = lerp(start, finish,t)


		local PathPart = Instance.new("Part")
		PathPart.Position = cubic
		PathPart.Anchored = true
		PathPart.Parent = workspace


		local point = CFrame.new((1-t)^3 * startP + 3 * (1-t)^2 * t * p1 + 3 * (1-t) * t^2 * p2 + t^3 * finishP) * CFrame.new(math.pi/2,0,0)
		local nextPoint = CFrame.new((1-nextT)^3 * startP + 3 * (1-nextT)^2 * nextT * p1 + 3 * (1-nextT) * nextT^2 * p2 + nextT^3 * finishP) * CFrame.new(math.pi/2,0,0)

		print(point,nextPoint)
		nuke:SetPrimaryPartCFrame(CFrame.lookAt(point.Position, nextPoint.Position) * CFrame.Angles(math.pi/2,0,0))


		task.wait(.01)
	end
end