Can 2 scripts attached to one object communicate with each other?

In UnityScript.

ok say i have magic points in my players status script(health, magic, strength, expirience etc), would i be able to write to ask my players status script what the magic variable current is from inside my abilities script? i want to search for my magic points amount, and if i have enough, allow the abilities coded inside of my abilities script. BOTH SCRIPTS are on ONE OBJECT.

i just dont know if i have to actually “search” for the variable “magicPoints” or if itll already know, sense both scripts are parts of a single rigidbody object.

if i can do this, what methods are possible?

Sure, if the abillities script needs to access those variables more than once, you should setup the reference in start:

private var playerStatus : NameOfYourPlayerStatusScript;

function Start()
{
    playerStatus = GetComponent(NameOfYourPlayerStatusScript);
}

function Update()
{
    if (playerStatus.magic > 20)
    // [...]
}

1.global variables.(i don’t recommend this)

declare as static so u can use it.

for instance script, name: script1,script2

script 1: variable  declaration

public static int magicDamage;

script 2: variable usage

damage = script1.magicDamage * spellPower;

////////////////

2.get as components 
script 1: variables public int magicDamage = 20;

script 2: int magicDamage;

declare variables normaly not static and just ask for the variables with GetComponent
and use them

magicDamage = GetComponent<script2>().magicDamage;

damage = magicDamage * spellPower;