increase speed when timer reaches zero

i am making an endless runner and i need to increase the speed of certain gameobjects when the timer reaches 0. im using the following script. The timer and movement work fine but speed changes for only a fraction of a second.


// Building movement

static var speed;

speed = -10;

function Update () {

var x = Time.deltaTime * speed;

transform.Translate(x, 0, 0);


and this is the countdown timer


private var startTime;
private var restSeconds : int;
private var roundedRestSeconds : int;
private var displaySeconds : int;
private var displayMinutes : int;

var countDownSeconds : int;

function Awake() 

function Reset()
    startTime = Time.time;

function OnGUI () {
    //make sure that your time is based on when this script was first called
    //instead of when your game started
    var guiTime = Time.time - startTime;

    restSeconds = countDownSeconds - (guiTime);

    //display messages or whatever here -->do stuff based on your timer
    if (restSeconds == 0) {

    //display the timer
    roundedRestSeconds = Mathf.CeilToInt(restSeconds);
    displaySeconds = roundedRestSeconds % 60;
    displayMinutes = roundedRestSeconds / 60; 

    text = String.Format ("{0:00}:{1:00}", displayMinutes, displaySeconds); 
    GUI.Label (Rect (400, 25, 100, 30), text);

please help.
im pretty new to coding. Thanks

You can Debug.Log(someVariable.ToString()) or you could use the debugger

thanks a lot… that solved the problem

all i had to do was declare the variable speed in countdowntimer.js and increment it there. then call it in movement .js