The title really says it all.
I'm building an AdminGui, I'm just adding the 10%. I want an ImageButton to rotate, and it does, but while the GUI is being tweened, you can click the button, rotate it, and cause the GUI to break temporarily. I have a debounce in place, but it's not effective because it deactivates immediately after clicking. So, I need it to deactivate the debounce after the GUI has been tweened.
So, "How would I use :wait() to wait until a ScreenGui's position is whatever?".
It's a simple do while function that takes rotate into account:
rotate = false --Debounce function waitUntil(ed,gui) --Create a function for waiting until a GUI is in the right spot if rotate == false then --If rotating is false repeat wait() gui.Rotation = 0 rotate = false until gui.Position == ed --force it to not rotate until the movement is finished return true --return true else repeat wait() until rotate == false --if rotate is true wait until rotate is false waitUntil(end,gui) --call the function return --return nil end end function rotate(gui) --Create a function for rotating rotate = true --set rotate to true for i=1,90 do -- or how many degrees you want to rotate it if rotate == false then break end --if the tween started stop gui.Rotation = gui.Rotation+1 --rotate game:GetService("RunService").RenderStepped:wait() --wait one frame end rotate = false --set rotate to false end