Arm Rotation with mouse input problem

There is an error in this arm rotation script with mouse input, I did with youtube tutorials and despite being identical to the video the arm does not move and the input of the mouse does not change until I move the character, i assignthe mainCamera tag to my camera

public class ArmRotation : MonoBehaviour {

private void Update () {

Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
difference.Normalize();

float rotZ = Mathf.Atan2 (difference.y, difference.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0f, 0f, rotZ);
}
}

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

Go read the docs: the above function needs to have a very specific value in the .z field or else it won’t return what you’re expecting it to. By just slinging mousePosition, you’re providing zero for that field, and this could account for any kind of misbehavior.