You probably need to drag the player transform onto the script of the prefab. If you didn't want to do that, you could use GameObject.Find or FindWithTag to initialize the variable in the start function.
Thank you for directing me to the right direction. It worked with the FindWithTag. Code (CSharp): using System.Collections; public class FollowScript : MonoBehaviour { public Transform target;//set target from inspector instead of looking in Update public float speed = 3f; void Start () { } void Update(){ //rotate to look at the player target = GameObject.FindWithTag ("Player").transform; transform.LookAt(target.position); transform.Rotate(new Vector3(0,-90,0),Space.Self);//correcting the original rotation //move towards the player if (Vector3.Distance(transform.position,target.position)>1f){//move if distance from target is greater than 1 transform.Translate(new Vector3(speed* Time.deltaTime,0,0) ); } } }