# How to rotate in a loop?

• I'd like to rotate an object 5 times in a loop. I setup it as the attached pic, but just rotate once.... anywhere wrong?

• @John-Liao you are using a rotate to angle behavior, so unless you are rotating it to a value that changes, it will keep rotating to the same spot(it won’t rotate😄). You should use a rotate by behavior instead.
Also, I wouldn’t use a loop....I’d just multiply the number you want to rotate by by 5 instead of looping five times.

• @John-Liao 1. As @iTap-Development said you are using rotate to angle which means it will rotate to that same angle, so maybe you should change it to a Rotate By behaviour. 2. You have the loop sitting at the bottom of rotate to angle, what you should have is loop sitting above it with a line drawn from the bottom of the loop to the rotate behaviour. 3. Loops will run pretty much instantly, you won't even see it rotate.

• Thank u.
I tried the rotate by behavior, as attached pic. However it's the same, only rotate once but not repeat 5 times in the loop.... anywhere wrong?

• @John-Liao what are you trying to achieve with this? A loop runs the behaviours below as fast as possible, meaning the next rotate behaviour activates before the current one finishes (it basically runs the behaviour 5 times at once). They overwrite each other due to their overlapping durations, so it will only do the last one. You could set the duration to 0, and then it will do all of them, but there's no point since it'll be instant.

• @Jack8680 Thanks. I solved the problem by using the "Multiply Values" to times the index value and degree value in the loop. As following pic.
Thanks a lot.

• @John-Liao Did this rotate five times as you wanted? What are the settings in your loop?

• @Deeeds it rotates 5 times because it's multiplying the last value of the loop index by 5 and rotating all of that at once. I forgot to reply here back then; the loop is basically doing nothing here.