Need help w Clash of clones

I keep dying, and then the other hero dies, but im not sure how to kill all the clones first without dying.
my code:

while(true) {
    var enemy = hero.findNearestEnemy();
    if (hero.isReady("cleave")) {
    hero.cleave(enemy);
    } else {
        hero.attack(enemy);
    }
}

Hi @justanotheruser and welcome to the forum! :partying_face:

Can you show me what equipment are you using?

Andrei

Welcome to the forum!
Where is “if enemy”?

What is @PeterPalov trying to say is what happens if there is no enemy?

Andrei

k ill show my Equipment

yeah but there is going to be enemies because of the clones at the beginning of the thing

i wish i could get the emperor gloves

How many gems do you have?

Andrei

bout 16 hundred, not enough, i need 3300

You could jump near the archers then cleve and attack them.

Andrei

Yeah, and maybe shield in the middle of armies. Then when your army beat Clone’s army you can bash, attack.

wow guys thanks a lot this really means a lot to me

So have you finished the level?

Andrei