Please use code tags. ( Using code tags properly )
I guess I’m confused as to whether all enemies are pooling their health (i.e. one takes damage, and they all take damage) or the enemies only share a health script, each with its own copy of the script and therefore its own HP. I’m also confused on why all the enemies are attached to the same game object - wouldn’t it make sense for each enemy to be a separate object which can have its own separate position?
What your code currently does is test the health, and depending on the value calls Damaged() for a different enemy script attached to the same object. I’m going to assume you only want one enemy per object, in which case it would make more sense sense (with minimal modification) to call ‘GetComponent()’ (no “transform” needed - each component knows about all the other components within the same object) in Start() and store it in an enemy variable, then access this variable to call Damaged().
However, how I would go about this is to make the code in the enemy script. The enemy script would have the health script cached in Start(), then access it in Update() to get the health, and act accordingly.
In terms of testing health, I would recommend a switch statement rather than a series of if statements.
switch (healthScript.pik) {
case 1:
//code for 1 hp
break;
case 2:
//code for 2 hp
break;
//etc
}