Kithgard Brawl - can't find my bug

I receive an "Unexpected token { " error, but can’t see what I messed up. I wanted to cleave when the cool down is over and enemies are close, else attack normally. The error points to the “else” line.

var enemy = this.findNearestEnemy();
if (this.isReady("cleave") && this.distanceTo(enemy) < 10) {
else (enemy) {
else {

Thanks. I don’t know why I wanted to put an argument there.

Now I get for the “if” line: “distanceToTarget is null. Does the target exist? (Use if?)”

I am using if. :unamused:

I’m pretty sure I copied this from the panel correctly…

I think I know why you put the (enemy) there (though at the wrong place.
It might be that there is no enemy when checking the distance, so you want to if (enemy) {...}.

I keep getting arugmenterror in this code, can someone help pls?
enemy = self.findEnemies()
if enemy: self.isReady(“cleave”)
if self.isReady(“electrocute”):

Your code suggest that you’re trying to first make sure that there actually is an enemy and then do something about it, so the line:

should be split into two separate if-statements.

k noted thx for your help!!!