Cant add to int from another script?

Hello everybody.

I want to add 10 health to my enemy every wave. In the SpawnWave() section of my script I added:

GameObject.Find("EnemyTest").GetComponent<EnemyTest>().maxHealth + (10);
GameObject.Find("EnemyTest").GetComponent<EnemyTest>().health + (10);  

These lines returns the error

“WaveSpawner.cs(137,88): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement”.

Can anybody tell me what this means and how to fix it? :slight_smile:

//Try this :

//----[ShortHand]----///
 GameObject.Find("EnemyTest").GetComponent().maxHealth  += 10;
 GameObject.Find("EnemyTest").GetComponent().health += 10;

or

/

//----[FullHand]----//
 GameObject.Find("EnemyTest").GetComponent().maxHealth  = GameObject.Find("EnemyTest").GetComponent().maxHealth + 10;

 GameObject.Find("EnemyTest").GetComponent().health =   GameObject.Find("EnemyTest").GetComponent().health  + 10;

I fixed it by putting the add health stuff in the enemyHealth script in stead of the WaveSpawer. Thanks for helping me out again guys :slight_smile: