i can't set destination, using AI Navmesh via raycast

/this must be applied to the AI with a NavMeshAgent/

private var NavComponent : NavMeshAgent;

var Target : Transform;

function Update () {
var hit : RaycastHit;

//GetComponent().destination = m_player.position;//follow c# version

NavComponent = this.transform.GetComponent(NavMeshAgent);
var up = transform.TransformDirection(Vector3.forward);
Debug.DrawRay(transform.position, -up * 10, Color.green);

if(Physics.Raycast(transform.position, -up, hit, 10)){//anything that gets hit including terrain

  if(hit.collider.gameObject.name == "Player"){//specific that gets hit 
  Debug.Log("Hit player");
   NavComponent.Destination  = Target.position;/*problem here*/



ok i fixed the problem by replacing it with
NavComponent.destination = Target.position;