How do I rotate an object inside of a GUI? (Image, button, etc..) I want it to repeat rotate until stopped (20-30 seconds)
All GuiObjects have a Rotation
Property. You can increment this Property in a numerical for loop to make a spin animation.
local guiObject = script.Parent --Object to rotate local incr = 1; for i = 1,360 do guiObject.Rotation = guiObject.Rotation + incr wait() end
If you want to continue this animation for 30 seconds, you can use the tick
function to decide how much time has passed.
local guiObject = script.Parent --Object to rotate local incr = 1 local Then = tick() --Time before it started rotating local limit = 30 --Amount of time it should spin while Then - tick() < limit do --Only animate within time limit for i = 1,360 do guiObject.Rotation = guiObject.Rotation + incr wait() end end