My find enemy command doesn't work in Lua

When I use the command enemy = self:findNearestEnemy() it says "There is no enemy. Use enemy = self:findNearestEnemy() first. Can someone help me?

Did you check if the enemy “exists” (that is, if self:findNearestEnemy found any enemy) using an if statement? Please post your code.

Well, my code so far is just that command. My Hero doesn’t move until it completes the command, so thanks for telling me. I’ll try what you said, even with as little information I know about coding.

Please post your entire code for the level so we can take a look. Or, do you mean or entire code is just that line? If so, that would likely be a bug.

By the way, what level are you playing?