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

How do rotate image label to 360?

I want to rotate my image label to 360 and keep rotating around here is the script i put:

while true do
	script.Parent.Rotation = script.Parent.Rotation +360
end

3 answers

Well, there's 2 ways to do it. (That I know of)

You can use a For Loop OR While Loop


For Loop

for i = 1,2000000000,10 do
	script.Parent.Rotation = i
	wait()
end

This is how it works.

The first number (1), is where it starts off at, the goal (2000000000), is where it wants to reach, and the third number (10), is how much it increments by.

So, every 0.03 seconds the frame will rotate by 10 until it reaches 2000000000, this will generate a smooth looking rotating label.

Example


While Loop

while wait() do
	script.Parent.Rotation = script.Parent.Rotation + 10
end

Example

This is how this one works.

This will wait 0.03 seconds and it will add 10 degrees to the current rotation of the label indefinitely.


So, however way you want to do it. Both of these methods work either way.

Hope this helped! If this worked, don't forget to select this as the answer!

6 comments

0

that for loop is cursed

0

What do you mean, cursed?

0

just very big number, while loop would be better since it's never ending

0

otherwise good explanation

0

that a upvote

0

Well, I usually use For loops for a certain amount of time as I want them to spin for. Loading screens are better off using while loops, or you can use ContentProvider and for every game service loading, it spins. But thanks for the upvote and useful tips!

You instantly set the label's rotation to 360, that won't be smooth nor allow you to notice it at all.

Second thing, you didn't add a wait() in your while loop, this will cause the script to crash.

If you want to make the image infinitely rotate I'd recommend you doing

while true do
	script.Parent.Rotation = script.Parent.Rotation + 1
	wait()
end

Even if it reaches 360, it will keep on rotating.

4 comments

0

https://www.iconfinder.com/icons/2739340/360_rotation_icon i want it to spin like that not like how roblox rotation

0

I don't think you can turn it horizontally, only vertically.

1

You can either use a spritesheet or use a viewport frame

1

Otherwise there is no way to rotate an image like that

First of all, you should have a wait in a loop or the game will freeze since it is too fast using "while wait() do" should fix this.

if you want the image label to rotate faster then increase the number. Just make sure it is less than 360 since that is a full rotation and won't appear as it rotating.

Here is the code:

while wait() do
    script.Parent.Rotation = script.Parent.Rotation + 1 -- the higher the number the faster it should rotate
end

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