Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do rotate image label to 360?

Asked by 4 years ago

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

Log in to vote
1
Answered by 4 years ago

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!

0
that for loop is cursed royaltoe 5144 — 4y
0
What do you mean, cursed? killerbrenden 1537 — 4y
0
just very big number, while loop would be better since it's never ending royaltoe 5144 — 4y
0
otherwise good explanation royaltoe 5144 — 4y
View all comments (2 more)
0
that a upvote Xapelize 2658 — 4y
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! killerbrenden 1537 — 4y
Ad
Log in to vote
0
Answered by
Norbunny 555 Moderation Voter
4 years ago

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.

0
https://www.iconfinder.com/icons/2739340/360_rotation_icon i want it to spin like that not like how roblox rotation mastercheeseit 77 — 4y
0
I don't think you can turn it horizontally, only vertically. killerbrenden 1537 — 4y
1
You can either use a spritesheet or use a viewport frame royaltoe 5144 — 4y
1
Otherwise there is no way to rotate an image like that royaltoe 5144 — 4y
Log in to vote
0
Answered by 4 years ago

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

Answer this question