How do you make things invisible?

So I tried to make the buildings tab turn invisible, when you haven’t clicked on it yet, and turn visible, when you click on it, all with a button.

public class BuildMenu : MonoBehaviour
{
void Start()
{
gameObject.SetActive(false);
}

void Update()
{
    if (Input.GetMouseButtonDown(0))
    {
        gameObject.SetActive(true);
    }
}

}

Your script will make it invisible if you left-click anywhere, not just a button. And since you make the object inactive, the script will stop working. Like Mr_Potato342 said, use private void OnMouseDown().
Also, I don’t know what your situation is, but consider the following:

private void OnMouseDown() {
        Renderer[] renderers = GetComponentsInChildren<Renderer>(transform);
        foreach (Renderer renderer in renderers)
            renderer.enabled = !renderer.enabled;
}

Everything is correct but remove the if statement and do it under void OnMouseDown()
this special void will be called only if you click ON the object

Hope I understood what ur trying to do and hope it helps
THIS VID WILL HELP YOU UNDERSTAND void OnMouseDown() IT IS ONLY 1 MIN LONG

this link