Change int value for 30 sec...

I’ve got AI script that moves forward at a set speed. I would like to have the AI to move forward at a faster speed for 30 sec when clicked by the mouse. How would I go about that? I would like to maintain this new speed for 30 seconds.

My Code:

var speed = 6;
var deer = 10;
var tap = 100;
var rotate;
var target : Transform;
var other : Transform;

function OnMouseDown () {
    LevelController.Points += tap + 100;


I’m not going to read through the script you cut-and-pasted whole, so here’s the pieces you’ll need:


var speedMultiplier = 1;

if (Input.GetMouse…)
speedMultiplier = 2;

yield WaitForSeconds (30);

You can figure out the rest.