Artificial intelligence for network

I have this script:

var Player : Transform;
var damp = 2;
var velocidadePerseguidor = 4;

function Update(){
 
 if(Player!=null){

  if(Vector3.Distance(Player.position,transform.position) < 20){
   var rotate = Quaternion.LookRotation(Player.position - transform.position);
   transform.rotation = Quaternion.Slerp(transform.rotation, rotate,damp * Time.deltaTime);
   transform.Translate(0,0, velocidadePerseguidor * Time.deltaTime);
  }

 
  if(Vector3.Distance(Player.position,transform.position) < 2){
   Destroy(Player.gameObject);
   animation.wrapMode =WrapMode.Once;
  }
 }
}

But he just follows the player if his name is “Player” and when I connect a new player, they are omeados of “Player (Clone)”
Does anyone have any suggestions so that he can follow every player

Use:
GameObject.FindWithTag(“Player”);

var Player : Transform;
// ...
{
Player = GameObject.FindWithTag("Player"); // Use FindWithTag() Instead of FindGameObjectsWithTag(). The 2nd finds every GameObject with Tag, so there might be a problem. If you want the AI to follow the nearest player, you'll have to create a function to calculate the distance and those. The distance function is Vector3.Distance
}

It’s only a matter of assigning the transform. Obviously 1 instance can not follow 2 players so you’ll have to have 2 instances or the amount of players.

miguelvesga, gave this error here:

appels, The system would basically like this: The object that come closest, he follows!

GameObject.FindWithTag(“Player”).transform

Well … It works a bit.
Except that when I instancializo a new player, “Player (Clone)”, it does not work!
But if I drag and place the player on the scene and run it, it works!

You may have to do with the network view? or the way that I’m instantiating?