How to make CFrame.LookAt part face the way I want it to instead of a certain rotation

Hello, the title may be confusing for many. I am trying to make a effect with bezier curves but I have a problem with the rotation part. I am trying to make the part front instead of sideways. But for some reason, it always stays sideways even if I change the rotation of the part. (CFrame.Angles/Orientation). Does anyone have any ideas how I could fix this? Thanks in advance!

Image:
image

Script:

local start = workspace.Start.Position
local ending = workspace.Done.Position
local mid = workspace.Mid.Position
local main = game.Workspace.Main

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

local function curve(p1,midd,p2,t)
	local l1 = lerp(p1,midd,t)
	local l2 = lerp(midd,p2,t)
	local quad = lerp(l1,l2,t)
	return quad
end
wait(5)

for i = 0,100,1 do
	local t = i/100
	print(t)
local ler = curve(start,mid,ending,t)
local ler2 = curve(start,mid,ending,t+0.1)
	local p2 = Instance.new("Part")
	p2.Parent = workspace
	p2.Position = ler
	p2.Anchored = true
	p2.CanCollide = false
	p2.Size = Vector3.new(1,1,1)
	p2.Transparency = 0.5
	local p = workspace.Part:Clone()
	p.Parent = workspace
	p.CFrame =  CFrame.new(ler, ler2)
	p.Position = ler
	wait(0.1)
end


	p.CFrame =  CFrame.new(ler, ler2)

Add an extra rotation

	p.CFrame =  CFrame.new(ler, ler2)*CFrame.Angles(0,math.pi/2,0)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.