I’m trying to use this script in a multiplayer game.
But the enemy only follows if the object name is “(Human).”
And when someone enters the server, gets the name “(clone)”
Someone help?
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);
}
}
}
i’m not sure the code you posted is relative to the problem your witnessing.
or if the problem you think you witnessing is actually the problem causing the behaviour you aren’t enjoying.