Instantiating an Object Only Once

I am working on an endless runner sort of game, in which the player is going to remain stationary while the plane beneath him moves and respawns creating the illusion of movement. My issue is I cannot for the life of me get this object to instantiate only once. After viewing other threads, I’ve tried using a boolean but obviously I’m doing something wrong. I tried writing a collision script also but ended up running into the same issue. Also I tried throwing in some wait time to try and fix it that way. It’s a mess. Here is the code with the boolean:

var respawnquery;

function Start () {
		respawnquery = false;

function Update () {

	transform.position.z -= 1 * Time.deltaTime;



function respawn(){
    yield WaitForSeconds(6);
    Instantiate(gameObject, Vector3(0,0,0), transform.rotation);
    respawnquery = true;

Yep, this code code will create hundereds of respawn coroutines since it will be called repeatedly until the first spawn is completed. A quick fix is to move the setting of ‘respawnquery = true’ to the top of the respawn() coroutine (before the yield). The issue is that the way you have it currently structured, the code waits 6 seconds before setting ‘respawnquery = true’. During that 6 seconds, every Update() call will generate another respawn() call. So if you were running at 60 fps, you will get 360 respawn() calls. And every one of those calls will Instantiate() a game object.