Animations affecting Torso Bending

I used @dthecoolest torso bending code for making the torso bend and so the legs would stay in place
but the cavalry animation that i have is affecting the legs

Torso Code

local TorsoLookVector = Torso.CFrame.lookVector
local Distance = (Head.CFrame.p - mouseHit).magnitude
				local Difference = Head.CFrame.Y - mouseHit.Y

				local yAxisWaistRotation = (((headPos - mouseHit).Unit):Cross(TorsoLookVector)).Y * 0.5
				local rotationWaistCFrame = CFrame.Angles(0, yAxisWaistRotation, 0)
				local goalWaistCFrame = rotationWaistCFrame*WaistOriginC0
				RootJoint.C0 = goalWaistCFrame.Rotation + WaistOriginC0.Position

Legs Code

local currentLegCounterCFrame = RootJoint.C0*WaistOriginC0:Inverse()

			local legsCounterCFrame = currentLegCounterCFrame:Inverse()
			if MountedHorse  then
				RShoulder.C0 = mainTor * base2
				LHip.C0 = legsCounterCFrame*LHipOriginC0
				RHip.C0 = legsCounterCFrame*RHipOriginC0