Calling functions via buttons when cooldown finished

How do I call a function when a cooldown (let’s say 30seconds) it’s finished?

What I do want to do is that when you press the button , Image.Fillamount (of the button) starts filling , when finished calls a function.

But I want to do that via button not via script. (after a lot of buttons it’s way to confusing)

What I mean is that you have to set the cooldown from the button not from the script.

You can call the wait function on the button’s OnClick() I believe.

IEnumerator wait(float time) {
yield return new WaitForSeconds(time);
}

wait(30f);