Problem with enemies chasing player

Ok, my other topic didn’t get any replies, I guess people didn’t understand my problem. So, my problem is, is that I’m making a survival game. The enemies don’t start already there, they get instantiated at the start, and than every time one dies a new one takes it’s place. The problem is, is that you can only add prefabs or objects that aren’t in that particular scene as the thing to follow, so I made a prefab of my main character and set that as the person to follow, but they don’t follow me they just swarm to the spot where my guy was standing when I made the prefab. I tried FindWithTag, and just Find but it says that gameobjects cant be used with the get gameobject.position command. Here is my code, does anyone know what to do?

// This is the object which follows 
var follower : Transform; 

// This is the speed with which the follower will pursue 
var speed : float = 2.0; 
  
// This is the range at which to pursue 
var chaseRange : float = 10.0; 

var enemyDead : float = 2.0;

var minDistance= 4;

var deadEnemy : GameObject;

var calledBefore : boolean = false;

var leader;

function Start(){
leader = GameObject.FindWithTag("Player");
deadEnemy = GameObject.FindWithTag("SpawnControl");
animation.wrapMode = WrapMode.Loop;
animation["death"].wrapMode = WrapMode.Once;
animation["idle"].wrapMode = WrapMode.Once;
animation["attack"].wrapMode = WrapMode.Once;
animation["Walk"].layer = 0;
animation["idle"].layer = 0;
animation["attack"].layer = 1;
animation["death"].layer = 2;
animation.Stop();
}

// This is used to store the distance between the two objects. 
private var range : float; 

function OnTriggerEnter(hit : Collider){
if(hit.transform.tag == "Player"){
if(calledBefore == true){
return;
}
else{
calledBefore = true;
EnemyisDead();
Kill();
}
}
}

function Update(){ 

   // Calculate the distance between the follower and the leader. 
   range = Vector3.Distance( follower.position,leader.position ); 
if (Vector3.Distance(transform.position, leader.position) < minDistance){
follower.Translate(Vector3.zero);
return;
}
else{
animation.CrossFade("idle");
}
if(hitPoints <= 0){
follower.Translate(Vector3.zero);
speed = 0.0;
Invoke("isDead", 1.95);
}
   if ( range <= chaseRange ){ 
      // If the follower is close enough to the leader, then chase! 
	  follower.LookAt(leader);
      follower.Translate( speed * Vector3.forward * Time.deltaTime); 
	  animation.CrossFade("Walk");
	  }


    
   else { 
      // The follower is out of range. Do nothing. 
      return; 

   } 
//End else (if ( range <= chaseRange )) 

} // End function Update() 
   var hitPoints = 1.0; 
function ApplyDamage (damage : float) 
{ 
   hitPoints = hitPoints - damage; 
   if (hitPoints <= 0.0) 
   { 
   follower.Translate(Vector3.zero);
   	  animation.CrossFade("death");
      if(calledBefore == true){
      return;
      }
      else{
	  EnemyisDead();      
      Kill();
      }
			
   } 
} 

function Kill(){
Destroy(this.gameObject);
}

function EnemyisDead(){
    var spawnAnother : EnemySpawn = deadEnemy.GetComponent(EnemySpawn);
    spawnAnother.enemyHasDied();
}

I think I’ve answered this in your first thread. I’d recommend bumping or adding extra information to a single thread rather than starting new ones with the same question.

sorry. No one was replying, so I was going to post again, but in previous forums that I’ve been on it’s against the rules to post more than like twice in a row in one topic.

you have an error in the code.
wrong:

<gameobject>.position

right:

<gameobject>.transform.position

besides, better to do like this:

private var leader : Transform; 

function Start(){ 
leader = GameObject.FindWithTag("Player").transform;
...
}

and then you can use

leader.position

ps: what is this for:

follower.Translate(Vector3.zero);

it is just doing nothing

Oh, thanks I was missing the transfrom part at the end. The follower.Translate(Vector3.zero) commands are for the enemy to stop moving, like if it dies, or something.