To fix the code, I put the switch to next costume into the repeat function so he will repeatedly move.