trying to make a Wave text (GUIText) to appear before each wave and last for only a few seconds

Im trying to make a Wave count display before each wave of the asteroid shooter (the tutorial game) and then dissappear after a few seconds, i have been able to get the text to appear once for the first game but once it dissappears (i use the destroyByTime script to make it dissappear) it never reappears saying that the gameobject has been destroyed but the thing is i put the GUIText in an empty gameobject naming it wavTXT and moved it to my prefabs folder.

i dont mind rewriting code

here is my code for the gameController:

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

public class gameController : MonoBehaviour {

    public GameObject hazard;
    public Vector3 spawnVals;
    public int hazCount;
    public float sWait;
    public float startWait;
    private int hazC;
    private int waveCount = 1;

    public GUIText waveTXT;
    public GameObject waveUI;
    public GUIText scoreTXT;
    private int score;


    private void Start()
    {
        score = 0;
        updateScore();
        updateWave();
        StartCoroutine (spawnWaves());
    }
   

    IEnumerator spawnWaves()
    {
        hazC = hazCount;
        while (true)
        {
            yield return new WaitForSeconds(startWait);
           
            for (int i = 0; i < hazC; i++)
            {
                Vector3 spawnPos = new Vector3(Random.Range(-spawnVals.x, spawnVals.x), spawnVals.y, spawnVals.z);
                Quaternion spawnRot = Quaternion.identity;
                Instantiate(hazard, spawnPos, spawnRot);
                yield return new WaitForSeconds(sWait);
            }
            hazC += 2;
            waveCount += 1;
            updateWave();
        }
    }

    public void addScore(int newVal)
    {
        score += newVal;
        updateScore();
    }

    void updateWave()
    {
        waveTXT.text = "Wave: " + waveCount;
        waveUI = Instantiate(waveUI, Camera.main.WorldToViewportPoint(gameObject.transform.position), Quaternion.identity);
       
    }

    void updateScore()
    {
        scoreTXT.text = "Score: " + score;
    }



}

Here is my DestroyByTime code:

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

public class timeDestroyer : MonoBehaviour {
    public float lifeTime;
    // Use this for initialization
    void Start () {
        Destroy(gameObject, lifeTime);
    }
   
}


I don’t remember exactly what GUIText is… normally I’d recommend using Text on a canvas, but that’s up to you.
back to your dilemma – I’d say make a reference to a script that is on your Text/GUIText.
On that script, have a function that takes an int as a parameter.

public ShowWaveText(int wavenum) {
   gameObject.SetActive(true);
   GetComponent<Text>().text = "Starting wave " + wavenum.ToString();
   Invoke("DisableText", 2);
  }
void DisableText(){
   gameObject.SetActive(false);
   }

So, the script reference… then when you start the wave, send the wave number to that function, it’ll activate the game object and update the text. It will then set a delayed invoke for the next method, which should disable the game object.
I think that’ll work.