ScreenToWorldPoint doesn´t work right.

In my Unity 2D project i wanted to make a drone, that follows the mouse cursor, but it didn´t worked. The drone always followed me, but not the cursor. Then I wrote this script to find the error, but I cant find anything. Please help me

The script:

public class hardtdrone : MonoBehaviour
{
    public float speed;
    Vector3 mousePos;

    void Start(){
      
    }

    void Update(){
        MoveDrone();
    }

    void MoveDrone(){
        mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition) - Camera.main.transform.position;
        mousePos.z = 10;

        if(transform.position.x < mousePos.x){
            //go right
            Debug.Log("right");
        }
        else if(transform.position.x > mousePos.x){
            //go left
            Debug.Log("left");
        }
        if(transform.position.y < mousePos.y){
            //go up
            Debug.Log("up");
        }
        else if(transform.position.y > mousePos.y){
            //go down
            Debug.Log("down");
        }


    }
}

Line 15: don’t subtract the camera position; the position returned is already correct in the world.

Also, you may want to put the .z term into the mouse first, so it casts into the scene properly from the camera. Review the docs for what this .z term means.