CFrame.LookAt issue

that one part does not rotate
image

local radius=newGear.PrimaryPart.Size.Magnitude
	local circle=math.pi*2
	for i=1,GearTeethCount do
		local angle=circle/GearTeethCount*i
		local x_pos = math.cos(angle) *radius
		local y_pos = math.sin(angle) * radius
		local p=Instance.new('Part',newGear.Teeth)
		p.Size=Vector3.new(GearTeethThickness,GearTeethHeight,GearRadius/GearTeethCount) 
		p.CFrame=CFrame.lookAt(GearPosition.Position + Vector3.new(0,x_pos,y_pos)/(2+GearTeethHeight),GearPosition.Position) * CFrame.Angles(math.rad(90),0,0)
		p.Anchored=true
	end
	````

Could you provide a little more information to find a solution?

it should create a gear that i can then use to build mechanisms and stuff, but you see that the upper middle tooth is rotated incorrectly to all others

It’s rotated correctly from a point on a circle facing the middle.

i need it to be rotated facing the same direction as other teeth of this same gear

i dont even know why i need this website sometimes but i fixed it by bluntly adding ‘if’ statements.

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