Managing multiple images fillamount by one function?

I want to fill the button that I clicked but when I click multiple buttons the button that I clicked before stops and the other button starts.

That’s the script :

public function ActionTime (actionSeconds : float) 
{
actionTime = actionSeconds;
actionTimeComplete = actionSeconds;

}

//COOLDOWN IMAGES
public function CooldownImage (imageForCooldown : Image)
{
imageCooldown = imageForCooldown;
CooldownFunction();
}

public function CooldownFunction ()
{
var actionTime = 0f;
imageCooldown.fillAmount=actionTime;
imageCooldown.GetComponent(Button).interactable = false;

while(actionTime < actionTimeComplete )
{
actionTime += Time.deltaTime;
imageCooldown.fillAmount=actionTime/actionTimeComplete;
yield;
}
moneyGlobal+=moneyToGive;
XPGlobal+=xpToGive;
imageCooldown.GetComponent(Button).interactable = true;
}

Everything works fine until I click another button. Basically that script can complete one image fillamount at once , how can I manage to complete multiple images without creating a bunch of functions?

Nevermind.

I got it. It was simpler than I tought.