How do you stop character arms from swinging?

Hello,

I’ve been having issues with the Motor6D.C0 value with my new gun script.

Anytime I move, the gun bobbles up and down.

Example: 2021-12-26 00-32-20.mp4 - Google Drive

Here’s an example of my code:

        local RightShoulder = char.Torso:WaitForChild("Right Shoulder")
        local Neck = char.Torso:WaitForChild("Neck")
        local X = -(math.asin((mouse.Origin.p - mouse.Hit.p).unit.y))
        local _, Y, Z = RightShoulder.C0:ToEulerAnglesXYZ()

        RightShoulder.C0 = CFrame.new(RightShoulder.C0.Position) * CFrame.Angles(X+math.pi/4, Y, Z+math.pi/4)
        Neck.C0 = CFrame.new(Neck.C0.Position) * CFrame.Angles(X+math.pi/2, Y+math.pi/2, Z)

In RunService.Stepped connection set the Motor6Ds.Transform transform to CFrame.new()

1 Like

Thank you!

I just have one issue, how do I revert the transform to its normal CFrame?

:Disconnect the connection, the normal animations should still be playing underneath the .Transform reset.

Works like a charm.

1 Like