If a motor is manipulated mid animation and then the attaching part is switched to another motor it breaks the 2nd motor

(I know the title is convoluted but I couldn’t think of a better way of putting this)

Here’s a demonstration of what the problem is:

When you click it plays the unique sword animation, however when you go into first person to make it look decent it attaches to a second part that has it’s own animation (ItemRoot). While in first person the ItemRoot is constantly updated to be facing the direction of the camera. When you exit third person the angle the ItemRoot was matching (down if the player was looking down) is now put into the arm’s C0/C1.

Any advice?

Code:

if Bind ~= nil then
	if CheckPart ~= nil and Camera ~= nil and DistancePart.LocalTransparencyModifier >= 0.95 then
		Bind.C1 = C1s["FPV"]
		Bind.Part0 = ItemRoot
		ItemRoot.itemroot.C0 = ItemRoot.itemroot.Part0.CFrame:Inverse() * Camera.CFrame * CFrame.new(0,-1,-1)
	elseif CheckPart ~= nil then
		ItemRoot.itemroot.C0 = CFrame.new(0,0,0)
		Bind.C1 = C1s["TPV"]
		Bind.Part0 = APar
	end
end

^ this is in a RenderStepped loop

1 Like