Cloudrip commander help needed

What am I doing wrong

# Summon some soldiers, then direct them to your base.

# Each soldier costs 20 gold.
while hero.gold > hero.costOf("soldier"):
    hero.summon("soldier")
    
soldiers = hero.findFriends()
soldierIndex = 0
# Add a while loop to command all the soldiers.
while True:
    soldier = soldiers[soldierIndex]
    hero.command(soldier, "move", {"x": 50, "y": 40})

# Go join your comrades!
hero.moveXY(51, 41)

It only sends one person

You are never incrimenting your soldierIndex, it is always set to [0], the same person. Try adding in a if soldier then command them, then increment your index with soldierIndex += 1

Hi, you might want to review while loops with indexes, used in levels like Shine Getter or Sand Snakes.