Hello, Need some help with invoke methods!!

Here I am trying to create a basic arkanoid game where random powerups prefabs are generated after a brick gets destroyed,the logic for random powerups is done but i wanted to generated these powerups after a time interval and change those interval randomly but basically im stuck :frowning: , i’ve created a invoke method which disables the bool that calls the Instantiate method (GeneratedPower) but after 5sec the bool value doesn’t changes and powerups keeps on popping , something is going wrong I just can’t figure it out , so please can some one help me with this Issue? Hope Im making sense I kinda new to forum and Unity…:stuck_out_tongue: and thanks in advance.
I’ve attached the Blocks.cs file.

**using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Block : MonoBehaviour
{ 
    [SerializeField] AudioClip breaksound;
    [SerializeField] GameObject particleeffectVFX;
    [SerializeField] int timeHits;
    [SerializeField] Sprite[] sprites;
    [SerializeField] public GameObject[] Powers;
    bool disablePower;

    level level;
    Rigidbody2D myRigidBody2D;

    public void Start()
    {
        CountBreakableBlocks();
        myRigidBody2D = GetComponent<Rigidbody2D>();
        disablePower = false;
        Invoke("DisablePower", 5f);
    }
    public void DisablePower()
    {
        disablePower = !disablePower;
    }
    private void CountBreakableBlocks()
    {
        level = FindObjectOfType<level>();
        if (tag == "Breakable")
        {
            level.CountBlocks();
        }
    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag.Equals("NormalBall") == true && tag == "Breakable")
        {
            HandleHits();
        }
    }

    private void HandleHits()
    {
        timeHits++;
        int maxHits = sprites.Length + 1;
        if (timeHits >= maxHits)
        {
            DestroyBricks();
        }
        else
        {
            FindObjectOfType<GameStatus>().AddtoScore();
            ShowNextHitSprite();
        }
    }
    private void ShowNextHitSprite()
    {
        int spriteIndex = timeHits - 1;
        if(sprites[spriteIndex] != null)
        {
            GetComponent<SpriteRenderer>().sprite = sprites[spriteIndex];
        }
        else
        {
            Debug.LogError("array out of index" + gameObject.name);
        }
    }

    private void DestroyBricks()
    {
        FindObjectOfType<GameStatus>().AddtoScore();
        AudioSource.PlayClipAtPoint(breaksound, Camera.main.transform.position);
        Destroy(gameObject);
        level.DestroyBlocks();
        TriggerParticleVFX();
        if(disablePower == true)
        {
            GeneratePower();/bool disablePower remains true after invoking
        }
    }

    public void TriggerParticleVFX()
    {
        GameObject sparkles = Instantiate(particleeffectVFX, transform.position, transform.rotation);
        Destroy(sparkles, 1f);
    }

    public void GeneratePower()
    {
        Instantiate(Powers[UnityEngine.Random.Range(0, Powers.Length)], transform.position, Quaternion.identity);
        disablePower = false; // the bool doesn't gets disabled and prefabs keeps on instantiating.
    }
}**

Thank you for your answers , i truly appreciate it but i made some slight changes and it seems to be working fine , this is what i did.

 void Update()
        {
            PowerTimer += Time.deltaTime;
            if (PowerTimer > 20f)
            {
                GeneratePowerup();
            }
            if(PowerTimer > 12f)
            {
                PowerDestroy();
            }
        }
        public void GeneratePowerup()
        {
            GameObject pow = Instantiate(generatePower[UnityEngine.Random.Range(0, generatePower.Count)], 
                new Vector3(Random.Range(1f,15f),Random.Range(8f,11f),0f), Quaternion.identity);
            PowerTimer = 0;
        }

Here I created a dontdestroyonload script and it generates powerups at random location from the range provided withing 20 sec of counter and destroys the powerup in 12sec which is already present in the scene.

Try replace Invoke with a coroutine.

public void Start()
{
	CountBreakableBlocks();
	myRigidBody2D = GetComponent<Rigidbody2D>();
	disablePower = false;
	StartCoroutine(DisablePower());
}

IEnumerator DisablePower() 
{
	yield return new WaitForSeconds(5);
	disablePower = !disablePower;
}