How do i acces my variables from my other script

I have my player script as follows. how would i make it so that when my attacking variable is true that i cant walk in my other script witch is the player controller?

var Playerstate : float;
var CanAttack : boolean = true;
var CanSprint : boolean;
var CanWalk : boolean;
var Sprinting : boolean;
var Walking : boolean;
var Attacking : boolean;
var TheAnimator : Animator;

function Update () 
{
	PlayerStateController();
}

function PlayerStateController ()
{
	if (Input.GetButton("Fire1") && CanAttack == true && Sprinting == false)
	{
		Walking = false;
		Sprinting = false;
		Attacking = true;
		CanSprint = false;
		CanWalk = false;
		CanAttack = false;	
	}
	if (Input.GetAxis("Vertical") !=0 || Input.GetAxis("Horizontal") !=0)
	{
		if (Input.GetButton("Sprint") && CanSprint == true && Attacking == false)
		{
			Playerstate = 2;
			Walking = false;
			Sprinting = true;
			Attacking = false;
			CanSprint = true;
			CanWalk = true;
			CanAttack = false;
			
		}
		else if(Attacking == false)
		{
			Playerstate = 1;
			Walking = true;
			Sprinting = false;
			Attacking = false;
			CanSprint = true;
			CanWalk = true;
			CanAttack = false;
		}
	}
	else if(Attacking == false)
	{
		Playerstate = 0;
		Walking = false;
		Sprinting = false;
		Attacking = false;
		CanSprint = true;
		CanWalk = true;
		CanAttack = true;
	}
}

function PlayerAnims ()
{
	if (Playerstate == 0)
	{
		
	}
	if (Playerstate == 1)
	{
	
	}
	if (Playerstate == 2)
	{
	
	}
}

You use GetComponent to access another script. If you have script A that wants to access script B, best practice is to resolve a reference to B in A’s Start method (using GetComponent) and store it in A. Then, when you want to access anything from B, you just use the reference.