Problem Setting Data Onto Another Script

I have two scripts, the script that contains all of my gui's called MyGUI and my EnemyAI

When an enemies curHealth (a variable) equals zero it should make the character's AttackXP = a number (another variable in a different script)

I have this variable in side of EnemyAI

public static MyGUI mg;

I do also have all the other variables needed for what im making... Inside of EnemyAI i also have this

 if(curHealth == 0)
        mg.AttackXP += GiveXP;

When the enemies curHelath equals zero it doesn't give the xp to the AttackXP which is in MyGUI.

I dont know what wrong at the moment and all help is appreciated.

Are you clamping curHealth to zero? My first thought is that you have it going past zero, into the negatives, so it's never equal to zero.

Otherwise, is curHealth a float? If so, try Mathf.Approximately instead of the == operator.

Just let us know if it's ever actually zero; Debug.Log it and watch the Console.