script problems

hey guys wats wrong with my script?? i want to do this

var mainCam : GameObject;

function Awake() { //set the mainCam variable to the MainCamera mainCam = GameObject.FindWithTag("MainCamera"); }

function OnTriggerEnter (other : Collider) { //check that the player has entered the trigger and not an enemy/other object if (other.tag == "Player") { //set the position of the camera to the current game objects position mainCam.transform.position = transform.position; //set the rotation of the camera to that of the game object rotation mainCam.transform.rotation = transform.rotation; } } 

var mainCamera : GameObject;

    function Awake() { 
    GameObject.FindWithTag("MainCamera");
    }
    function OnTriggerEnter (other : Collider) {
    mainCamera.transform.rotation = transform.rotation; } 
    }

so whats wrong with this one??

var mainCamera : GameObject;

    function Awake() { 
    GameObject.FindWithTag("MainCamera");
    }
    function OnTriggerEnter (other : Collider) {
    mainCamera.transform.rotation = transform.rotation; } 
    }

it does not work ubity crashes on it the usual error fix compiler error

Just a couple of typos - fixed below. :)

var mainCamera : GameObject;

function Awake() { 
    mainCamera = GameObject.FindWithTag("MainCamera");
}

function OnTriggerEnter (other : Collider) {
    mainCamera.transform.rotation = transform.rotation;
}