ToOrientation causes weird flipping when part changes angle

local RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(function()
	for i,Player in pairs(game.Players:GetChildren()) do
		local Character = Player.Character
		if Player.Character and Player.Character:FindFirstChild("activeODMG") then
			if Player.Character.activeODMG:FindFirstChild("Rgear") then
				Character.activeODMG:WaitForChild("Rgear").Anchored = true
				Character.activeODMG:WaitForChild("Lgear").Anchored = true

				local RX,RY,RZ = Character:WaitForChild("Right Leg").CFrame:ToOrientation()
				Character.activeODMG:WaitForChild("Rgear").CFrame = Character.activeODMG:WaitForChild("Rgear").CFrame:Lerp(CFrame.new(Character["Right Leg"].CFrame.Position)*CFrame.fromOrientation(0, RY, RZ), .6)

				RX,RY,RZ = Character:WaitForChild("Left Leg").CFrame:ToOrientation()
				Character.activeODMG:WaitForChild("Lgear").CFrame =  Character.activeODMG:WaitForChild("Lgear").CFrame:Lerp((CFrame.new(Character["Left Leg"].CFrame.Position)*CFrame.fromOrientation(0, RY, RZ)), .6) 
				--

			end

		end
	end
end)

I’m aware the above code is… lackluster but I’m trying to solve the issue at hand right now. Here’s the issue in effect:

Any help? The animation has no data for the parts, and I’ve tried a different running animation to no avail.

1 Like