Cant click on GamObject

So I’m trying to make a clickergame. i want a menu to open when my sprite is clicked.
Righ now I’ve got a script that detects the click but it doesnt matter where I click, it just opens it.

using UnityEngine.EventSystems;

public class BuyMenuBB2 : MonoBehaviour, IPointerClickHandler
{
    public GameObject buyMenu;

    public void OnPointerClick(PointerEventData eventData)
    {
        throw new System.NotImplementedException();
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject())
        {
            OpenBuyMenu();
        }
    }

    public void OpenBuyMenu()
    {
        buyMenu.SetActive(true);
    }
    public void CloseBuyMenu()
    {
        buyMenu.SetActive(false);
    }
}

I have a button setup that closes the menu.

Try using a raycast

private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        { 
        RaycastHit hit;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit, 100.0f))
            {
                if (hit.transform != null)
                {
                    PrintName(hit.transform.gameObject);
                }
            }
        }
    }

    private void PrintName(GameObject go)
    {
        print(go.name); //I just made the object print name here but you can do what you wish :)
    }