Problem with Vector3 Distance and Mouse Input,

Hi,
I have a problem with my Mouse Position.
So the idea is , that I compare the position of my Mouse with the position of my gameobject.
When the distnace of these two is smaller than my maximum distance variable, I destroy my gameobject.
But when I play my game nothing happens and the Input isn’t registered.

Here is my code:

    public class Tropfen : MonoBehaviour
    {
       public float speed = 10.0f;
       Rigidbody2D rb;
       AudioSource source;
       [SerializeField] AudioClip[] soundClips;
       [SerializeField] GameObject particleEffect;
       float isMuted;
       Gameplay gameplay;
       Camera mainCam;
       [SerializeField] float maxDistance = 0.25f;

    // Start is called before the first frame update
    void Start()
    {
        mainCam = Camera.main;
        rb = GetComponent<Rigidbody2D>();
        rb.velocity = new Vector2(0, -speed * Time.deltaTime);
        gameplay = FindObjectOfType<Gameplay>();
        source = GetComponent<AudioSource>();
        source.clip = soundClips[Random.Range(0, soundClips.Length)];
        isMuted = PlayerPrefs.GetFloat("Muted");
        if (isMuted == 0)
        {
            source.volume = 0;
        }
        else if (isMuted == 1)
        {
            source.volume = 1;
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            GetInput();
        }
    }

    private void GetInput()
    {
        Vector3 mousePos = Input.mousePosition;
        Vector3 worldPos = mainCam.ScreenToWorldPoint(mousePos);
        var plane = new Plane(Camera.main.transform.forward, transform.position);
        var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (plane.Raycast(ray, out var hitDistance))
        {
            var worldPoint = ray.GetPoint(hitDistance);
            var TropfenTouchDistance = Vector3.Distance(worldPos, transform.position);

            if (TropfenTouchDistance <= maxDistance)
            {
                TropfenDestruction();
            }
        }

    }

    private void TropfenDestruction()
    {
        Destroy(gameObject);
        if (isMuted != 0)
        {
            AudioSource.PlayClipAtPoint(source.clip, transform.position);
        }
        GameObject effect = Instantiate(particleEffect, transform.position, Quaternion.identity) as GameObject;
        Destroy(effect, 2f);
        gameplay.IncreaseScore(1);
    }
}

So at first theres a problem right at your Destruction Methode:
You’re destroying the gameobject, which has the script attached, before you check all that other stuff, so it will never happen, because the script also doesnt exist anymore.

Second:
I really dont get it, why you’re creating a plane, to find out, if you’re mouse is in distance or not. So if you’re read the documentation for a plane: Unity - Scripting API: Plane.Raycast you will see, that your plane always will return false, because the ray is wrong.

If you want to find out, if your mouse is pointing at the object or not, simply use Physics.Raycast:

Vector3 mousePos = Input.mousePosition;
Vector3 worldPos = mainCam.ScreenToWorldPoint(mousePos);
if (Physics.Raycast(worldPos,mainCam.transform.forward,out var hitDistance))
         {
             var TropfenTouchDistance = Vector3.Distance(worldPos, transform.position);
 
             if (TropfenTouchDistance <= maxDistance)
             {
                 TropfenDestruction();
             }
         }