How to fix my : find the distance to a target unit error



is there anything i did wrong ? if so can somebody explain to me


@Muhd_Hisyam_Hanafi_H one of the challenges here is to understand how hero.findNearestEnemy() works.

If you run this statement and no enemies are in the game yet (or within in your sight range based on the glasses equipment) then this will method/function will return “NULL”. So if you add a piece of code that checks if the “enemy” exists before trying to find the distance to it, this error should go away.

Right now you are asking the game to find the distance to a non existent enemy, and that is why it is complaining.


ohh ok thank you so much