Simple ladders script - what am I doing wrong?

Hey

I'm trying to write a script that will allow my first person controller to climb ladders that are set at about 80 degrees. I'm not too bothered about realism I just want it to work so that the game can be played. I have tried 3 or 4 different ways to write a script but I've not managed, and on one occasion wrote one that crashed unity every time I previewed the game! Here is my latest attempt - can you see where I'm going wrong?

private var controller = GetComponent(CharacterController);

function OnControllerColliderHit (hit : ControllerColliderHit)
{
    if (hit.gameObject.tag == "ladder") {
        climb();
    }
}

function climb() {
    controller.slopeLimit = 90;
}

@script RequireComponent(CharacterController)

I'm not entirely sure what I'm doing as I've just looked at a couple of other scripts and tried to piece together how to control slopelimit. But basically I need the slope limit to be set at 45 unless the player is touching the ladder, whereby I need it to be 90.

I could do with an answer quickly as I need to finish this today!

Thanks!

Have now fixed this using invisible steps :)