I'm trying to make my enemy pick a player from array that no enemy around him. Now, if player surrounded with 3 enemies, the rest will select second player closest to them. How to make enemy pick the second player ? Code (CSharp): public GameObject[] players; public GameObject AttackThisPlayer; public int player_number; public bool PlayerSurrounded; // script attached to player, if 3 enemies around him it turn True. public bool attackPlayer = false; // if enemy enter player zone turn true. So the rest will not pick this player. void Start() { players = GameObject.FindGameObjectsWithTag("Player"); // 5 players } void Update() { for (int i = 0; i < player.Length; i++) { if (Vector3.Distance(transform.position, players[i].transform.position) < Vector3.Distance(transform.position, players[player_number].transform.position)) { player_number = i; AttackThisPlayer = players[player_number]; } } PlayerSurrounded = AttackThisPlayer.GetComponentInChildren<enemy_around>().enemiesBool; } void OnTriggerEnter(Collider other) { if (other.transform.CompareTag("Player") ) { attackPlayer = true; } } void OnTriggerExit(Collider other) { if (other.transform.CompareTag("Player")) { attackPlayer = false; } } }