Help How to stop spawning objects?

Hello I have multiple spawn spots & the enemies wont stop spawning when the player gets destroyed

public class Spawner : MonoBehaviour {

public GameObject Enemy;
public Transform[] spawnSpots;
private float timeBtwSpawn;
public float startTimeBtwSpawns;

void Start(){
    timeBtwSpawn = startTimeBtwSpawns;     
}

void Update(){ 

    if(timeBtwSpawn <= 0){
        int randPos = Random.Range(0, spawnSpots.Length - 1);
        Instantiate(Enemy, spawnSpots[randPos].position, Quaternion.identity);
        timeBtwSpawn = startTimeBtwSpawns;
    } else{
        timeBtwSpawn -= Time.deltaTime;

    }
    
}

Hi, You could check if the Player exist. If doesn’t exist stop spawning enemies.

     void Update() { 
if (GameObject.Find("Player") != null)
   {
         if(timeBtwSpawn <= 0
         {
             int randPos = Random.Range(0, spawnSpots.Length - 1);
             Instantiate(Enemy, spawnSpots[randPos].position, Quaternion.identity);
             timeBtwSpawn = startTimeBtwSpawns;
         }
         else
         {
             timeBtwSpawn -= Time.deltaTime;
         }
}

It work for me, thank you