NotChanging Variables

Hello guys, sorry for bothering but I have a little problem. I have added in my CharacterMotor script a running script that looks like this :

var running : boolean = false;
var cannotRun : boolean = false;
var timer : float = 0;

if(Input.GetButtonDown ("Run"))
    {  
    running = true;
        }
        else if(!Input.GetButton("Run"))
        {
        running = false;
        }
                if(running == true){
                	maxForwardSpeed = 5;
					maxSidewaysSpeed = 5;
					maxBackwardsSpeed = 5;
                   timer += Time.smoothDeltaTime;
                        }
                        if( timer >= 20){
                        timer = 20;
                        running = false;
                        cannotRun = true;
                        }
                                       
                        if( timer <= 10){
                        cannotRun = false;
                        }
                                                       
                        if ( cannotRun == true){
                        running = false;
                        }
               
                 if(running == false){
                    maxForwardSpeed = 3;
					maxSidewaysSpeed = 3;
					maxBackwardsSpeed = 3;                                     
                    timer -= Time.smoothDeltaTime;
                    }
                    if( timer <= 0){
                    timer = 0;
                    }

It is attached to Function Update()
My maxForwardSpeed is not changing and I don’t know why.

Thanks for future help.

CharacterMotor : Unity3d - Motion - Pastebin.com

It is because you are not setting the “maxForwardSpeed” of your classes instance. In line 66 of your full code you see that the instance of the class “CharacterMotorMovement” is called “movement”.

What you need to do is change any place that you try to adjust a value of “movement” from (examples):

maxForwardSpeed = 5;
maxSidewaysSpeed = 5;
maxBackwardsSpeed = 5;

To:

movement.maxForwardSpeed = 5;
movement.maxSidewaysSpeed = 5;
movement.maxBackwardsSpeed = 5;

Thank you for help !