Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to loop a for loop?

for i = 1, 360, 1 do
	wait()
	print(i)
	script.Parent.Rotation = i
end

This simple for loop makes an image rotate around, but once i = 360 it stops. How can I get this so the image constantly spins around, instead of spinning once and then stopping?

1 comment

0

Wrap your for loop in a while loop, it will make it run forever that way.

1 answer

✓ Accepted answer

You can nest this "for" loop in a "while" loop.

while true do
	for i = 1, 360 do
		wait()
		print(i)
		script.Parent.Rotation = i
	end
end

1 comment

1

Are you serious lol. I hate when people ninja me. I'll delete my answer.

This discussion is preserved as it was. New answers, comments, and votes are closed.