When I was working on my game I started trying to add more stuff into it, so I added a little script that rotates a gui. However the gui will not rotate, what did I do wrong?
while wait(1) do script.Parent.Rotation = script.Parent.Rotation - 1 repeat wait(1) until script.Parent.Rotation == -11 if script.Parent.Rotation == -11 then script.Parent.Rotation = script.Parent.Rotation + 1 repeat wait(1) until script.Parent.Rotation == 11 break end end
This might be what you're looking for:
while wait() do if script.Parent.Rotation >= 0 then repeat wait() script.Parent.Rotation = script.Parent.Rotation - 1 until script.Parent.Rotation == -11 end if script.Parent.Rotation < 0 then repeat wait() script.Parent.Rotation = script.Parent.Rotation +1 until script.Parent.Rotation == 11 end end
Try this:
local plus = false while wait(1) do if plus == false then script.Parent.Rotation = script.Parent.Rotation - 1 elseif plus == true then script.Parent.Rotation = script.Parent.Rotation + 1 end if script.Parent.Rotation == -11 then plus = true elseif script.Parent.Rotation == 11 then plus = false end end
Hope this helped!