How can I change the speed of a character controller on the fly?

Hi, I’m trying to intergrate a Sprint Fuction for the Untiy First Person Controller but I’m slightly baffled because of the way the code is written.

I want to press Left Shift to run faster and when i let go it goes back to normal speed and here’s what I’ve been doing.

I’ve found the variable “maxForwardSpeed” and it is set as

var maxForwardSpeed : float = 10.0;

And later on in the code I find…

var zAxisEllipseMultiplier : float = (desiredMovementDirection.z > 0 ?
                                      movement.maxForwardSpeed : 
                                      movement.maxBackwardsSpeed) / 
                                      movement.maxSidewaysSpeed;

So if I’m doing it right could the code be like this?

function Update()
{
  if( Input.GetButtonDown( "Sprint" ) )
  {
  }
}

But I’m stuck from there, I’m new to scripting and I have no Idea what to type into the Scripting Reference, can someone help me please?

Thanks for reading. (This is written in Javascript)

You could try the following:

var sprintSpeed : float = 15.0;
var normalSpeed : float = 10.0;

var maxForwardSpeed : float = normalSpeed;

function Update() {
    if (Input.GetButtonDown("Sprint")) {
        maxForwardSpeed = sprintSpeed;
    } else {
        maxForwardSpeed = normalSpeed;
    }
}