How can i make the camera to folow my object wherever it goes?

I want the camera to chase my object. I tried the following code-

using UnityEngine;
using System.Collections;

public class CameraLookAt : MonoBehaviour {
public Transform target;
void Update () {
transform.LookAt(target); } },

but it doesn’t seem to work. What can i do?

If you Google your question you’ll most likely get a answer. And put your script in code tags so people can read it much better and help you.

Click here