How do i add a delay to how often a unity ui button may be used?

Hello everyone! I am currently having an issue which i have no idea how to solve so hopefully someone out there might be able to help me!

The issue I am having is that I am unsure how i could add a delay to how often a button may be used, i have tried using yield return new WaitForSeconds however this does not seem to add a delay

Any suggestions on how to fix this or a workaround to this will be greatly appreciated!

You can do this by messing with the Time.deltaTime that unity provides.

Here is an example:

 private float timeLeft = 30.0f; //30secs
 public bool CanButtonBePressed = true;
 
 void Update()
 {
     if (!CanButtonBePressed) 
     {
          timeLeft -= Time.deltaTime;
          if(timeLeft <= 0)
          {
               CanButtonBePressed = true;
               timeLeft = 30.0f; //reset
          }
     }
 }

Just make sure to set canButtonBePressed to false when u press the button.