Old prefab clone is not destroying, but new clone does

I can’t destroy old prefab clone, but can destroy new clone, if i create clone i can destroy it, but if i create 2 clones i can destroy last one, but previous wouldn’t destroy, help please, i can’t find information about this problem.

ItemSpawn.cs

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

public class ItemSpawn : MonoBehaviour
{
   
    public GameObject[] clothes;
    //public Transform objspawn;
    public float coord;
    public float spawnrate;
    public float speed;
    public int rand;

    ItemMovement io;
   public GameObject duplObj; //клон clothes
    public int i;
    void Start()
    {
        
      
         InvokeRepeating("SpawnObj", 0f, spawnrate);
    }

   
    void Update()
    {
       
    }

    void SpawnObj()
    {
     
        rand = Random.Range(0, clothes.Length);
       

               duplObj= Instantiate(clothes*, new Vector2(-11.7f,1.68f), transform.rotation);*

}

}
ItemMovement.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ItemMovement : MonoBehaviour
{
ItemSpawn itemSpawn;
Rigidbody2D rb;
public bool b=false;
void Start()
{
b = false;
itemSpawn = GameObject.Find(“Spawnreact”).GetComponent();
rb = GetComponent();
}

private void FixedUpdate()
{
transform.Translate(itemSpawn.speed * Time.deltaTime, 0, 0);
}

private void OnTriggerEnter2D(Collider2D collis)
{
if (collis.gameObject.tag == “Destroy” && !b)
{
Destroy(itemSpawn.duplObj);
}

}
}

@DgFlex You should add a class to prefab with the OnTriggerEnter2D function.

the way you have things setup, you only have 1 variable to store your duplicated spawned object… ie. you shouldn’t make more than one of them.
Your solutions to this would be…

  1. destroy the old one, “before” you make a new spawned object.
  2. (better solutions) maintain a list of spawned objects, instead of just a variable… then use List.Add and Remove to maintain your list of spawned objects. Remove it from the list, then destroy it.
    This works for any number of spawned objects.