HELP! Scripts looks fine but doesn't respond?

first of all here is the script

public Text Redtext;
public Text Bluetext;
public Text Bigtext;

bool RedisOn;
bool BlueisOn;

public float delayTimer;
public float spwanMostwait;
public float spwanlesswait;
float timer;

int RedScore;
int BlueScore;

void Start () {

	StartCoroutine (Spwaner ());

	timer = delayTimer;

	RedScore = 0;
	BlueScore = 0;

}

// Update is called once per frame
void Update () {

	Redtext.text = " " + RedScore;

	Bluetext.text = " " + BlueScore;

	delayTimer = Random.Range (spwanlesswait,spwanMostwait);

	timer -= Time.deltaTime;

	if (timer <= 0) {

		if (delayTimer < 10) {
			RedText ();
			timer = delayTimer;
		}

		if (delayTimer > 11) {

			BlueText ();
			timer = delayTimer;
		}
	}

	}

public void RedText (){

	Bigtext.text = "Red";
	RedisOn = true;
	BlueisOn = false;

}

public void BlueText(){

	Bigtext.text = "Blue";
	RedisOn = false;
	BlueisOn = true;

}

void OnCollisionEnter2D (Collision2D col) {

	if (RedisOn == true && BlueisOn == false) {
		if (col.gameObject.tag == "Red") {
			RedScore += 1;
		}
		if (col.gameObject.tag == "Blue") {
			Destroy (gameObject);
		}

	}
	if (BlueisOn == true && RedisOn == false) {
		if (col.gameObject.tag == "Blue") {
			BlueScore += 1;
		}
		if (col.gameObject.tag == "Red") {
			Destroy (gameObject);
		}
	}


}

IEnumerator Spwaner() {

	while (true) {

		yield return new WaitForSeconds (delayTimer);
	}
}

my problem is the “BigText” doesn’t show , which means that the delayTimer doesn’t respond.

but when I change the delaytimer to timer in the if (delayTimer < 10) line, it works but I get no Random, I tried everything here but no solution so how I make this work so I get random text shown.

What values have you set for all your variables? Especially “spwanlesswait” and “spwanMostwait”?

You also have a dead-zone in your “delayTimer” range. If the value is between 10 and 11 nothing will happen. Though since you would constantly roll a new value it’s probably not a problem.

Next weird thing is, why do you use Random.Range outside of the if(timer <= 0) check? You only need a new random number when you enter that block.

Finally a logical problem. You use the delayTimer value to reset your timer. However “red” is only choosen when delayTimer is “small” (less than 10). “Blue” is only choosen when delayTimer is “large” (greater than 10 or 11). That means on average the most time the color will be Blue as blue always gets the longer wait times. This seems very weird.

Finally what is the “Spawner” coroutine good for? At the moment it does nothing besides waiting. Since you change “delayTimer” constantly it’s quite unclear for how long the coroutine waits. It certainly is not in sync with your “timer”.

You probably want something like this:

timer -= Time.deltaTime;
if (timer <= 0)
{
    timer = Random.Range (spwanlesswait, spwanMostwait); // set a new random wait time
    if (Random.value < 0.5f) // 50:50 chance to pick either red or blue
    {
        RedText ();
    }
    else
    {
        BlueText ();
    }
}

ps: you have a typo in your “spwanlesswait” and “spwanMostwait” variables. You also use inconsistent casing. They probably should be “spawnLessWait” and “spawnMostWait”.