Need help with Tool following arm

I am working on a fighting game and am adding the ability to “aim” your sword slashes based on where you look. The problem is that the arms will follow the camera just fine but the tools, which I used a Motor6d to attach to the torso, will not follow the arm on their own. I don’t know how to proceed.

image

game:GetService("RunService").RenderStepped:Connect(function()

	local CameraDirection = Root.CFrame:toObjectSpace(camera.CFrame).lookVector
	if Neck and humanoid.Health > 0 then
		if player.Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then

			Neck.C0 = CFNew(0, YOffset, 0) * CFAng(3 * math.pi/2, 0, math.pi) * CFAng(0, 0, -asin(CameraDirection.x)) * CFAng(-asin(CameraDirection.y), 0, 0)

			leftArm.C0 = leftArmOrigin
			rightArm.C0 = rightArmOrigin

			if player.Character:FindFirstChildOfClass("Tool") then

				rightArm.C0 = CFNew(1, 0.5, 0) * CFAng(3 * math.pi/2, 0, math.pi) * CFAng(-asin(CameraDirection.y), 0, 0) * CFAng(4.7,4.7,9.5)
				leftArm.C0 = CFNew(-1, 0.5, 0) * CFAng(3 * math.pi/2, 0, math.pi)  * CFAng(-asin(CameraDirection.y), 0, 0)* CFAng(7.5,1.5,6.5)

			end
		end
	end
end)

Well, why would the sword follow the arms if it’s welded to the Torso as you said? Shouldn’t it be welded to one of the hands?

1 Like

to add on to what Synteuro said, because it’s welded to the torso, it will only follow the torso. Because the torso doesn’t follow the arms as you have shown in the screenshot, the sword won’t follow the arms.