Attaching camera to instantiated object

Hello everyone!
I’m absolutely stumped. I spawn a player into the game along with a camera and a few blocks, but I can’t fathom at all how to get that camera to follow the character once it’s been spawned. I attempt to attach a camera to the spawn using the AddComponent method, which loads the camera into the scene absolutely fine. It’s just the tracking I can’t figure out. Any insight would be most appreciated!

var playerPrefab:transform;
var target:Transform;
var cam:Camera;

function Start() {
target = Instantiate (playerPrefab, transform.position, Quaternion.identity);
cam = gameObject.AddComponent(Camera);
}

function Update() {
// Presumably camera controls go in here such as lookat(target)?
}

Thanks very much!

The code in most camera scripts has its own target variable, and is set to track that transform. All you have to do is take a pre-existing camera (you could create one in the code, but why bother?) and change that target var:

// your spawn line:
target = Instantiate(plyrPF, transform.position, Quaternion.identity) as Transform;
// tell camera to track it:
cam.GetComponenent<camScript>().target = target;