Adding FPS to NavMesh Script

OK, using this generic code for enemies…problem is, the Unity 4.6 FPS character controller, can’t be added to the enemy PreFab…it works if I add it in the hieracharcy…but won’t work from a prefab, that I want to spawn.How do I fix this?

using UnityEngine;
using System.Collections;
 
public class navmesh : MonoBehaviour {
    NavMeshAgent agent;
    public Transform target;
 
    // Use this for initialization
    void Start () {
        agent = GetComponent<NavMeshAgent>();
            }
   
    // Update is called once per frame
    void Update () {
        agent.SetDestination(target.position);
    }
}

nevermind figured it out

player = GameObject.FindGameObjectWithTag ("Player").transform;