Destroying clones?

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

public class OnCollision1 : MonoBehaviour
{
public Transform other;
public GUIStyle style;
public GameObject crate2;
public GameObject GameObject3;

void OnGUI()
{
	if (other)
	{
		float dist = Vector3.Distance(other.position, transform.position);
		if(dist < 20 )
		{
			if (GUI.Button (new Rect (600, 100, 100, 100), "NO")) {
				Destroy(crate2);
				Destroy(GameObject3);
			}
			GUI.Button(new Rect(800, 100, 100, 100),"YES");
			GUI.TextArea(new Rect (600, 250, 300, 100), "Do You Want To Open This Crate?", style);

		}

	}
}

}

I have this code to destroy a crate when it collides with the player. I copy the same code to the clone which spawns in during the game. Since I can not define “crate2” as the clone of the original crate, it doesn’t destroy the clone of the crate. How can I fix this? Thanks.

Put a script onto the crate prefab(the one used to instantiate) that will call Destroy(self) when destruction is needed.

I hope this helps!