Mind boggling CFrame issue

So I made a crouch animation, and when I press “C” it changes my default idle and walk animations to Crouch animations. The only problem is that while I’m holding my gun, it executes this code:

RS.RenderStepped:Connect(function()
	if not HoldingGun then return end
	Char:SetPrimaryPartCFrame(CFrame.lookAt(
		HRP.CFrame.Position,
		Vector3.new(Mouse.Hit.Position.X, HRP.CFrame.Position.Y, Mouse.Hit.Position.Z)
	))
end)

This essentially makes it so the character faces the mouse position, but the only problem is that when you crouch while this is active this happens:

The crouching works perfectly fine when I’m not bothering the Humanoid Root Part’s CFrame.

Anyone know why this is happening?

This might be because the “Motor6D” in the root part of the player that attaches to the torso, you may need to just lower it down with CFrames.

My initial thought is that the Torso position is being overwritten by whatever animation you are playing when holding the gun? That could possibly be why

The upper or lower torso? In the case of the crouching animation they are both being overwritten, the lower torso bounces up and down.

You might need to adjust your holding animation so that the torso has no keyframes, or set animation priority of the crouching to a higher priority than the holding one

Wait, so you’re saying the CFrame thing in my renderstepped function isn’t the problem? The animation is?

From what I saw in the videos, possibly? I’m not too sure.

Turns out it was, just started experimenting with it. Not %100 fixed but it was clear the animations were the issue, thanks

1 Like

No problem, glad I could help :slightly_smiling_face: