Help with my 2d script !!

Hey guys,i was wondering if you could help me with my 2d game script :) basically at the moment my player can walk jump and etc. but thing is i want the player to walk with booleans. for example if my player was walking right i would want the following boolean to be false " var WalkingRight : boolean = false;" in this case it already is so if the player hits the left key i want the "var WalkingRight : boolean = false;" to be true so the movement for walking right would stop and then the player can walk left. but if the player hits the right key while the player is walking left i want it to turn the players left walking boolean to be true and then make the var WalkingRight : boolean = false; boolean false so the player can then walk right again. im not sure if this makes any sense lol. i would be really great full if someone could help me :) i have tried before but it never works i can still walk right if the boolean is true. please someone help me :) thank you very much in advance :)

 private var xOffset = 0.0;
var Water : float = 4;
 //public var  lockedRotation: float = 0;
var speed : float = 5;
var  jump  : float = 10;
var DoubleJump : int = 1;
var JumpReset : int = 2;
var JumpResetWallHit : int = 1;
var JumpVariance : float = 5;
//ar CenMass : float = 1;
var HitWallCollider: boolean = false;
var RayCastDist : float = 3;

//var springSpeed : float = 10;
var ClimbSpeed : float = 5;
static var Climbing: boolean = false;

var WalkingRight : boolean = false;
var WalkingLeft: boolean = false;
//var SecWait : float = 0.3;

 function Start ()
{

//rigidbody.isKinematic = true;

}
function FixedUpdate ()
{
    var movement : float = Input.GetAxisRaw("Horizontal") * speed;
    movement *= Time.deltaTime;

    //rigidbody.centerOfMass = Vector3 (0, CenMass, 0);

    if(Input.GetKey("d"))

    {

        rigidbody.velocity = Vector3(speed , rigidbody.velocity.y, 0);
    }

    if(Input.GetKey("a")){

        rigidbody.velocity = Vector3(-speed , rigidbody.velocity.y, 0) ;
    }

    if (DoubleJump > 0)
    {           
        if (Input.GetKeyDown(KeyCode.Space))
        {
                rigidbody.isKinematic = false;
                rigidbody.velocity = Vector3(0,jump ,0);

                DoubleJump -= 1;
        }
    }
    if (Input.GetKey(KeyCode.Space))
    {
            rigidbody.isKinematic=false;
            rigidbody.AddForce(Vector2(0,JumpVariance));
            Climbing = false;

            //constantForce.relativeForce = Vector3(0, -10, 0);
    }
    if (Climbing == false)
    {
        rigidbody.isKinematic = false;

        transform.Translate(Vector3(movement,0,0));
    }
    if (Climbing == true)
    {
        //transform.localPosition.x = 0;
        transform.rotation = transform.parent.rotation;
        transform.parent.gameObject.rigidbody.AddRelativeForce(Vector3.right * Input.GetAxis("Horizontal") * 3, ForceMode.VelocityChange);
    }   
    if(Input.GetButtonDown("Jump")&& (HitWallCollider == true )){

        Debug.Log("Gravity is true player will fall");

     rigidbody.useGravity = true;
     Debug.Log("Drag is set back to 0");

                rigidbody.drag = 0;
                Debug.Log("Kinematic is set to false move free");
                rigidbody.isKinematic = false;

                    Debug.Log("Hey! you hit the wall DoubleJump is reset");

                Debug.Log("Not hitting wall");
    HitWallCollider = false;
}
}    

thanks in advance :)

not really tested but I think it may work

var move_right = 0;

if(Input.GetKeyDown("d")){
move_right = 1;
}
if(Input.GetKeyDown("a")){
move_right = 2;
}
if(!Input.GetKey("a")&&!Input.GetKey("d")){
move_right = 0;
}
if(Input.GetKeyUp("d")){
if(move_right == 1){
move_right = 2;
}
}
if(Input.GetKeyUp("a")){
if(move_right == 2){
move_right = 1;
}
}
if(move_right == 0){
//stand(no movement in right and left)
}
if(move_right == 1){
//move right
}
if(move_right == 2){
//move left
}

Note that I change some parts to make it easy to understand

Hope it works :)