rotating to mouse location

i tried to rotate the arm in my main character to the mouse location but instead my code manges to rotate it in some weird direction ‘when the character’ moves only…
note: im not sure if this will make a difference but i have a static main camera (not moving)

This may not be your issue, but the code you have here will only work for an Orthographic camera. This:

 Camera.main.ScreenToWorldPoint(Input.mousePosition)

…will always return the position of the camera for a perspective camera. For a perspective camera, you will need to set the ‘z’ parameter to a distance in front of the camera. So assuming the distance you wanted was 10, you would do:

Vector3 pos = Input.mousePosition;
pos.z = 10.0f;
Vector3 difference = Camera.main.ScreenToWorldPoint(pos) - transform.position.