Arms Go crazy based on mouse position

How can I fix the arms going crazy? this is what happens when I move the mouse:

I dotn know whats wrong. And I don’t know why the other arm is just standing there and not moving the the other arm? How can I fix it? this is the script for the server:

game.Players.PlayerAdded:Connect(
    function(player)
        player.CharacterAdded:Connect(
            function(Character)
                local Torso = Character:WaitForChild("HumanoidRootPart")
                local tool = script.Parent
                local Motor6D = Instance.new("Motor6D", Torso)
                Motor6D.Part0 = Torso
            end
        )
    end
)
game.ReplicatedStorage.MoveArms.OnServerEvent:Connect(
    function(plr, Motor, ToolHandle)
        Motor.Part1 = ToolHandle
    end
)

this is the client script:

local UserInputService = game:GetService("UserInputService")

local player = game.Players.LocalPlayer
player.CharacterAdded:Connect(function(Character)
	    local mouse = player:GetMouse()
        local tool = script.Parent
        local Torso = Character:WaitForChild("HumanoidRootPart")
        local Motor = Torso.Motor6D
		tool.Equipped:Connect(function()
		UserInputService.InputChanged:Connect(function(input, engine_processed)
			if input.UserInputType == Enum.UserInputType.MouseMovement then
				game.ReplicatedStorage.MoveArms:FireServer(Motor, tool.Handle)
                Torso.Motor6D.C0 = Torso.Motor6D.C0 * CFrame.Angles(math.asin((mouse.Hit.p - mouse.Origin.p).unit.y), 0, 0)
				end
            end)
    end)
end)