How do I make my enemies "Level up"?

I am trying to make a survival game where each enemy I kill I get one added to my score. After I get to 10 my enemies “Level up” and I get 2 added to my score with them getting 50 more health. Here is my code for my score:

#pragma strict
static var scores: int = 0;

function OnGUI() {
GUI.Box(Rect(1, 1, 100, 20), "Score:" + scores);
}
function Update(){
	if (scores == 10);{
	EnemyHealth.levelUp += 1;
	}
}

and for my enemies:

#pragma strict

var enemyHealth: int = 100;
static var levelUp: int = 0;
static var scoreUp: int = 1;

function Update(){
 if (enemyHealth <= 0){
 	Destroy(gameObject);
 	Score.scores += scoreUp;
 }
 if (levelUp == 1){
 	enemyHealth += 50;
 	scoreUp += 1;
 }
 }

The problem I am having is that the first enemy that spawns(I am using one prefab and one spawnpoint) has the 150 health and adds two to my score and after that they keep adding two instead of one. When I get to ten it doesn’t add any to the health or the scoreUp. Please help. Thanks in advance =)

you can have a lookup table like

level1 = 100hp
level2 = 200hp
level3 = 300hp

or you can do something like

//pseudocode

int level;

int oldLevel;

int healthBonus = 50;

int score;
int levelThreshold = 10; //10 kills required for levelup

int enemyHealth = 100;



if(enemyHealth <=0)
{
score += 1;
Destroy(gameObject);// possibly enemy.gameObject?

}

if(score > levelThreshold)
{
score = 0; //reset score to start for next levelup
oldLevel = level;
level+=1;
}

if(level > oldLevel)
{
enemyHealth += healthBonus;
oldLevel = level;
}

the reason your code isn’t working right is because you are adding 1 to scoreUp everytime,

+= is very dangerous in this context. Your code is incrementing every frame, which is probably causing your unexpected behaviour.

I would suggest a more deterministic method, as opposed to an incremental one.

if (scores >= 10){
    EnemyHealth.level = 2;
}

Note: You also have an extra ; in your if that will cause your script to misbehave.