Make Instantiated object follow player.


I have this game where enemy spaceships are spawned randomly in the world and then should follow and shoot the player.But the problem is that when I use the LookAt(target) function and then assign my player object the assignment is not made in the prefab.
So, when running the game, the enemy is instantiated from the prefab the var target is missing.

So, how do I fix this, or is there any other method apart from LookAt(target) to make things work?

Create_Alien.js —>

var aliens : Rigidbody[];		///Array to hold different types of ships
private var sec : int;			///Time Delay
private var savedTime : int;	///Stuff

var vel : float = 10;		///Velocity of the spawned object
var h_range : float = 10;  ///The max-min horizontal spawn range
var ePos : float = 50;		///Distace from origin where spawn takes place
var density : float = 10;   ///No of objects spawned at a time

function Start () {


function Update () {

	sec = Time.time*density;//shoot at regular intervals//

////This function Instantiates the object at a random point on a plane////
function create(sec){
		var clone : Rigidbody;
		clone = Instantiate(aliens[Random.Range(0,aliens.Length)],
				// Give the cloned object an initial velocity
		clone.velocity = transform.TransformDirection (Vector3.back * vel);
		savedTime = sec;

Attack.js —>

function Start () {

var target : Transform;   	//The Player
var moveSpeed : float = 10;	//Movement speed

function Update () {
/////Begin looking at target(Player) and move towards it./////
	transform.position += transform.forward * moveSpeed * Time.deltaTime;

/////When the ship is close enough to the player/////
function OnTrriggerEnter(hit : Collider)
	if(hit.gameObject.tag == "Player")
		moveSpeed = 0;
		///Begin shooting///


Drag the prefab into the scene, assign the player object into the target slot, and then click the “Apply” button near the top of the Inspector pane to apply the changes to the prefab. You can now delete the instance you just created from the scene, and all future instances created from that prefab will have the player set as target.

As Pterto stated, a easy and simple way to do this is to find the Player’s transform when the enemies are created.

function Start () {
 target = GameObject.Find("PlayerName").transform;

Another way you could do it as well is to store your player in a GameObject and reference that as you need.