Motor 6D is not working with arm movement script

Hello! I have got some trouble with a script that rotates arms depending where the position of the mouse is. However, it seems that my motor 6D guns do not like this script, so the arms do rotate, but the Motor 6D is stuck.

Here is a gif that shows how the arms are moving but the gun is just stuck:

https://gyazo.com/6810788e243bd24e4e50feaea5601bd9

This is how I move arms and how I attempted to move the gun, which was already very close but not close enough. The “main” variable describes the ToolGrip that my gun is attached to. It is located in the Torso. I followed Stacky’s tutorial for this setup.

				local rightX, rightY, rightZ = hum.Parent.Torso["Right Shoulder"].C0:ToEulerAnglesYXZ()
				hum.Parent.Torso["Right Shoulder"].C0 = (hum.Parent.Torso["Right Shoulder"].C0 * CFrame.Angles(0, 0, -rightZ)) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y))

				local leftX, leftY, leftZ = hum.Parent.Torso["Left Shoulder"].C0:ToEulerAnglesYXZ()
				hum.Parent.Torso["Left Shoulder"].C0 = (hum.Parent.Torso["Left Shoulder"].C0 * CFrame.Angles(0, 0, -leftZ)) * CFrame.Angles(0, 0, math.asin((-mouse.Hit.p - -mouse.Origin.p).unit.y))
			
				local main = hum.Parent.Torso:FindFirstChild("ToolGrip")
				if main then
					local rightX, rightY, rightZ = hum.Parent.Torso["Right Shoulder"].C0:ToEulerAnglesYXZ()
					main.C0 = (hum.Parent.Torso["Right Shoulder"].C0 * CFrame.Angles(0, 0, 0)) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y)) * CFrame.Angles(0, math.rad(-90), 0)
				end

This is the tutorial I used:

Can anyone please help me with how I could correctly move my gun up and down by moving the cursor?

2 Likes

Isn’t the ToolGrip supposed to be in the right arm/shoulder? I’m not too familiar with this and it looks like the gun is attached to the Torso.
For a custom animation should the gun be controlled like in this post?

Making arms for weapons move to match cursor location

1 Like

You can also attach it to the Torso, which allows for extra animation possibilities. It was taught like that in the tutorial as well.

1 Like

Did you happen to follow this direction in step 3?
Do Not name the part as Handle.”

1 Like

Part is not named Handle. It is called “BodyAttach”. I followed all of the steps in the tutorial.

1 Like