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

How to rotate a gui? (Effects)

I am trying to make a gui wobble back and fourth between 5 and -5 then restart the process from the opposite side back. I am mainly trying to do this in a convenient way that also makes the gui rotate smoothly.

Code:

local frame = script.Parent.Frame


while true do
for i = -5,5,.1 do 
wait()
frame.Rotation = i 
for i = 5,-5,.1 do 
wait()
frame.Rotation = i 
end
end 
end 

Thanks in advanced. I also want to try and stick to coding this in a more compact way other than listing every single rotated value wait waits in between.

1 answer

Just move the ends around

Wait for the first for loop to end before starting the next.

local frame = script.Parent:WaitForChild("Frame")

while true do
	for i = -5,5,.1 do 
		frame.Rotation = i 
		wait()
	end
	for i = 5,-5,-.1 do 
		frame.Rotation = i 
		wait()
	end 
end 

I also used a negative 0.1 on line 8 so that it counts down, and I used WaitForChild on line 1 to define Frame.

Good Luck!

If I helped, please don't forget to accept my answer.

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