Progressively Faster Run

How can I make the Player Controller progressively move faster the longer you run?

Do something like this

var speedUpTime : float;
var running : boolean;
var originalSpeed : float;

function Start(){
originalSpeed = speed;
RunFaster();
}

function RunFaster(){
while(true){
if(running){
speed += 0.1;
yield WaitForSeconds(speedUpTime);
}
else{
speed = originalSpeed;
}
yield;
}
}

All you have to do is make a “running” variable and set that to true while running, and call this function from the Start function (it will run continously), then whenever you stop running speed is set back to the originalspeed.

EDIT: Whoops, forgot to add in a “yield WaitForSeconds” (otherwise it will be getting called way to fast). Added it in.

Thanks! I’ll give this a try tonight!