Navmesh agent problem

İ have agent idle…i made trigger to when i pass as FPS controller agent follow me and game over…But agent start follow but it stops place where i pass trigger not following me…

using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.AI;
 public class hedefbul : MonoBehaviour
 {
     public GameObject target;
     public NavMeshAgent agent;
     // Start is called before the first frame update
     void Start()
     {
        
     }
 
     // Update is called once per frame
     void OnTriggerEnter()
     {
         agent.SetDestination(target.transform.position);
 
 
     }
 }

Right, you only set the target position once. If you want it to follow an object, you need to update your path repeatedly. There may be a cleaner way to do this, but here is an easy way -

using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.AI;
  public class hedefbul : MonoBehaviour
  {
      public GameObject target;
      public NavMeshAgent agent;
      public float pathUpdateInterval = 1f;

      private GameObject activeTarget = null;
      private float timer = 0f;
      
      // Start is called before the first frame update
      void Start()
      {
         
      }

      void Update(){
          if(activeTarget == null) return;
          
          timer += Time.deltaTime;
          if(timer >= pathUpdateInterval){
              timer = 0;
              agent.SetDestination(activeTarget.transform.position);
          }
      }
  
      // Update is called once per frame
      void OnTriggerEnter()
      {
          activeTarget = target; 
          timer = pathUpdateInterval;
      }
  }