Button Multiple Press Leads to Multiple Execution of Function

I have been using Unity’s UI buttons to make a clickable object. I gave it a function.

–snip–

public void Click(){
    if (clickcount == 0) {
        clickd = true;
        clickcount += 1;
}

–snip–

This function links to this other function in the same object:
–snip–

void OnTriggerStay2D(Collider2D other){
    if (clickd && other.gameObject.CompareTag ("touchable")) {
            other.gameObject.GetComponent<CowRules> ().DEATH ();
    }
}

–snip–

then the DEATH() part sets clickcount to 0 and clickd to false.

But then, when I clicked the button twice or more, the button’s script executes twice and sets clickd to true twice.

How do I fix this? Thanks.

That makes sense… What is it you want it to do, instead?

I mean, can they only click once while in the trigger?
What is the purpose of click count?

The click count’s purpose is to set clickd to true only once, but right after the DEATH() sets clickd to false, the button’s second click (which was stacked) sets clickd to true again, which gives an unintended result.

Edit: I solved the problem using another solution. Thanks for the help!