Motor6Ds on legs don't work as expected

Hi All,

Game concept is irrelevant here, but in my game, players are able to turn into cats which resemble their characters (R15). I’ve tried to achieve this without having to create a set of animations for cat-like movement, and have instead made a system to “hack-ily” rotate the Motor6Ds in a players character to match the proportions of a cat.

Everything works fine with this system, except for the fact that when a player stops moving, their legs will inexplicably rise, instead of staying pointing towards the ground. This is shown here in this (insanely cute) demo video:

At the beginning of my code, I delete all the animation assets under the “Animate” script in the player. This is to make sure each player has the same animations for when they become a cat, as it will default to, well, a default animation. The important parts of the code are shown below:

for _, AnimationValue in ipairs(Character:WaitForChild("Animate"):GetChildren()) do
	if not AnimationValue:IsA("BindableFunction") then AnimationValue:Destroy() end
end
local RootMotor6D = Character:WaitForChild("LowerTorso"):FindFirstChildOfClass("Motor6D") do
	RootMotor6D.C0 = CFrame.new(0, -0.75, 0) * CFrame.Angles(-math.pi / 2, 0, 0)
end
local NeckMotor6D = Character:WaitForChild("Head"):FindFirstChildOfClass("Motor6D") do
	NeckMotor6D.C0 = CFrame.new(0, 0.8, 0) * CFrame.Angles(math.pi / 2, 0, 0)
end
local LeftShoulderMotor6D = Character:WaitForChild("LeftUpperArm"):FindFirstChildOfClass("Motor6D") do
	LeftShoulderMotor6D.C0 = CFrame.new(0, 0.4, -0.5) * CFrame.Angles(math.pi / 2, 0, 0)
end
local RightShoulderMotor6D = Character:WaitForChild("RightUpperArm"):FindFirstChildOfClass("Motor6D") do
	RightShoulderMotor6D.C0 = CFrame.new(0, 0.4, -0.5) * CFrame.Angles(math.pi / 2, 0, 0)
end
local LeftHipMotor6D = Character:WaitForChild("LeftUpperLeg"):FindFirstChildOfClass("Motor6D") do
	LeftHipMotor6D.C0 = CFrame.new(0.5, -0.2, -0.2) * CFrame.Angles(math.pi / 2, 0, 0)
end
local RightHipMotor6D = Character:WaitForChild("RightUpperLeg"):FindFirstChildOfClass("Motor6D") do
	RightHipMotor6D.C0 = CFrame.new(-0.5, -0.2, -0.2) * CFrame.Angles(math.pi / 2, 0, 0)
end

Wondering what could be causing the inexplicable leg rise. Thanks!

You have so many extra “do” in that script