Instantiated clones doesnt have script refferences attatched

So…i am having this script :

public class spawner : MonoBehaviour {
public GameObject obj;
public GameObject spObj;
 public Transform spawnpoint;
 private float repeatRate = 7.0f;
 void Start()
  void OnTriggerEnter(Collider other)
       if (other.gameObject== obj)
     InvokeRepeating("Spawner", 0.5f, repeatRate);
     Destroy(gameObject, 11);
     = false;
  void Spawner()
     Instantiate(spObj, spawnpoint.position, spawnpoint.rotation);
  } }

But when i am making a clone of an object the object cloned doesnt have some references in the script like an audio source and some game object references …so it makes my object clone not acting like the original…,So i have an object that can be picked up and destroyed But when i make a clone of it with a script (on collider enter etc) the clone although it has the scripts attatched doesnt have some audio source and gae object references attatched to the script …and it makes the clone broken…what can i do?

hello, most likely your spObj is an asset prefab. your object isnt loosing reference since assets prefabs cant have reference (just for an easy understanding why this is happening, your spawnObject might have a reference to a player but in a different scene that player doesnt even exist) the easiesr¡t solution for this is not creating a prefab, and just attach the object from the scene directly, that way it will have the same reference than that object that has been attached to.