Script Not Working Raycast GetMouseButtonDown()

After I start the game and click on 2D gameObject with tag “Star”… only Debug.Log(“OK”); executes. Script is not attached to the gameObject with tag “Star”.
Help please.

if (Input.GetMouseButtonDown(0))
    		{
    			Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    			RaycastHit hit;
    			
    			Debug.Log("OK");
    			
    			if (Physics.Raycast(ray, out hit))
    			{
    				if (hit.transform.tag == "Star")
    				{
    					Destroy(gameObject);
    					Debug.Log("GREAT");
    				}
    				
    				Debug.Log("HMM");
    			}
    		}

That’s because you are destroying yourself. But what you want to do is to destroy the object you clicked on, so replace this line of code:

Destroy(gameObject);

with this:

Destroy(hit.transform.gameObject);

Im sorry but if i’ll do that only with this:

 if (Input.GetMouseButtonDown(0))
                 {
                     Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                     RaycastHit hit;
                     
                     Debug.Log("OK");
                     
                     if (Physics.Raycast(ray, out hit))
                     {
                         if (hit.transform.tag == "Star")
                         {
                             //without Destroy
                             Debug.Log("GREAT");
                         }
                         
                         Debug.Log("HMM");
                     }
                 }

It still executed only ‘‘OK’’. Have i mentioned that it is collider 2d? - does it matter? I have read somewhere that the raycasts work only for 3d objects. Try it in your unity 2d- 1) Create a sprite with Circle collider add rigidbody2d component
2) give it tag “Star”
3) copy the code
4) see what happens