Ground cycle destroy,Ground destruction problem

Hi, I’m making a roll a ball game to find my level cuz I didn’t used unity for a long.

I made a 15x15 ground separated in 15x15 (225) cubes.

I want one of them get selected every 5 sec then color it red for 0.5 sec and then destroy it.

My problem is that I want the cubes to disapear one by one evry 5 sec and they all disapear in a few seconds.

Youtube video showing what’s happening.

Here’s my script:

#pragma strict

var RN : int = -1;
var groundPart : GameObject[];
var destroyCooldown : int = 5;
var timer : float = 0;
var groundIsDestroyed : boolean = true;

function Start () {
	groundPart = GameObject.FindGameObjectsWithTag("Ground");
}

function Update () {
	if(groundIsDestroyed == true) {
		Cooldown();
	}
}

function Cooldown () {
	yield WaitForSeconds(destroyCooldown);
	groundIsDestroyed = false;
	DestroyGround();
}

function DestroyGround () {
	if(groundIsDestroyed == false) {
	RN = Random.Range(0, groundPart.length);
	if(RN <= groundPart.length) {
		groundPart[RN].GetComponent(MeshRenderer).material.color = Color.red;
		yield WaitForSeconds(0.5);
		Destroy(groundPart[RN]);
	}
	RN = -1;
	groundIsDestroyed = true;
	}
}

Thank you for ur help.

WaitForSeconds() etc. only work in Coroutines(). You need to call those functions with StartCoroutine().