Why does ''target is null'' display to me?

please edit your code like this

some more code

if you are looking for several enemies u have to find the enemy iside the loop.
there is not everytime an enemy, use if/else to define what u do.

there are several posts in this forum about the same problem… if you would have searched u would have found a reason…
Try this…