The If-Stravaganza level help? (LUA)

Please take a look at the picture below:

This what is the code that I wrote for the if-statement level. I’m 100% sure that I’ve written the code correctly and even searched up for the solution, in which I got similar to this. Though the code does not work when I execute it, instead it returns me with an error message saying “this.findNearestEnemy is not a function” as highlighted on line 4 of my code.

Does anyone know the solution to this? I’ve tried everything, thanks

Do you have the right glasses on?

1 Like

try : instead of . and try to cleave, because you have a warrior

 local enemy = hero:findNearestEnemy()
     if enemy and self:isReady("cleave") then self:cleave(enemy)
        if enemy then self:attack(enemy) 

Yeah your prediction was correct, I didn’t have the right glasses on >_<

But it’s strange since the glass that I’m using in the screenshot had the “findNearestEnemy” function and is more advanced then the beginner glass - which only had one function, the “findNearestEnemy”. Yet I had to equip that specific one in order for it to work. Could this be an unnoticed bug?


it says i cant use ‘local’ or ‘enemy’

1 Like

Post your code. Make sure you are using the right language, local is only for LUA, use var for JS and nothing for Python.

Lua: local enemy =

Js: var enemy =

Python: enemy =

I still cant get it to work can you help me?

Please post your code so we can assist you. Remember to use the </> button so it formats properly.

1 Like

while True:
enemy = hero.findNearestEnemy()

I am so confused on this level

You started the level in LUA? ?
You code can be similar to:

while true do
    local target = hero:functionToFindTheEnemy()
    if target then
        hero:attackTheEnemy(target )
1 Like

it wont let me do local

if you click the link:
image click restart
and then write you code:
I suppose you really want LUA

1 Like

can’t click the link

never mind I got the link to work

I don’t know what to do after that

Just do what the comments say, and if you’re stuck, try reading the hints

1 Like

It says that iI have to put ()

Welcome‌ ‌@Jeremiah_Zirkle welcome‌ ‌to‌ ‌the‌ ‌forum!‌ ‌It‌ ‌is‌ ‌a‌ ‌lovely‌ ‌place‌ ‌where‌ ‌you‌ ‌can‌ ‌share‌ ‌all‌ ‌kinds‌ ‌of‌ stuff‌ ‌(appropriate‌ ‌of‌ ‌course),‌ ‌share‌ ‌bugs,‌ ‌and‌ ‌even‌ ‌get‌ ‌assistance‌ ‌for‌ ‌code!‌ ‌We‌ ‌suggest‌ ‌that‌ ‌you‌ ‌review‌ ‌this‌‌ topic‌ ‌which‌ ‌shows‌ ‌all‌ ‌essentials‌ ‌of‌ ‌this‌ ‌board!‌ ‌And‌ ‌we‌ ‌suggest‌ ‌you‌ ‌review‌ this topic‌ ‌which‌ ‌shows‌ ‌how‌ ‌to‌ ‌post‌ ‌your‌ ‌code‌ ‌correctly!‌ ‌Thanks!!‌ ‌ :partying_face: :partying_face:

If you’re in Python, then yes, you have to put () at the end for the function to work.