Camera points towards object but doesn't go to it

Here is my player script:

public class PlayerControler : MonoBehaviour {

public float speed;
public Text countText;
public Text winText;
public static Vector3 lastPosition;

private Rigidbody rb;
private int count;
void Start ()
{
	rb = GetComponent<Rigidbody> ();
	count = 0;
	SetCountText ();
	winText.text = "";
}
	
void Update ()
{		
	float moveHorizontal = Input.GetAxis ("Horizontal");
	float moveVertical = Input.GetAxis ("Vertical");

	Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

	rb.AddForce (movement * speed);
	Vector3 lastPosition = transform.position;
}

	void OnTriggerEnter(Collider other)
	{
		if (other.gameObject.CompareTag("Pick Up"))
		{
			other.gameObject.SetActive (false);
			count = count + 1;
		SetCountText ();
		}
	}
void SetCountText ()
{
	countText.text = "Count: " + count.ToString ();
	if (count >= 12) {
		winText.text = "You Win!!";
	}

}
}

//Destroy(other.gameObject);

And here is my camera script:

public class Accessor : MonoBehaviour {
void Start()
{
	GameObject thePlayer = GameObject.Find("Player");
	PlayerControler playerScript = thePlayer.GetComponent<PlayerControler>();
}
}
public class CameraController : MonoBehaviour {

public GameObject player;
public float moveSpeed = 5.0f;
private Vector3 offset;
public Transform target;

// Use this for initialization

// Update is called once per frame
void LateUpdate ()
{
	transform.position = PlayerControler.lastPosition;
	transform.LookAt (target);
}

}

I’m pretty sure it was originally from a tutorial, but still. The objective is for the camera to go to the position that the player was in the previous frame, and then point at the player now. It successfully points at the player, but it just stays in place. Help please

You have member variable lastPosition in PlayerControler, but you set the position to a local variable lastPosition in Update(). To fix it just delete Vector3 from before it (because that signifies you are declaring a new variable).

The same thing with playerScript in Accessor.Start(): you store it in a local variable. Move the declaration of the variable outside of Start(), and then you don’t have to make lastPosition static (be careful with using static variables, unless you know what you are doing, avoid them).

Not sure, it’s after 3am, but is it your LateUpdate function?
Try this and see if it works:

 void LateUpdate ()
 {
     transform.position = playerScript.lastPosition;
     transform.LookAt (target);
 }

If that was the problem, it was because you made the proper reference to the Component in the Start function:

PlayerControler playerScript = thePlayer.GetComponent<PlayerControler>();

…but in the LateUpdate you still used PlayerControler:

 transform.position = PlayerControler.lastPosition;

(PlayerController is missing an L by the way)