Advertisement
lygelz23

SlidingGui

Dec 11th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. local debounce = 0 --- this means the gui is closed
  2. local menu = script.Parent.Parent.ImageLabel -- quick way to reference the menu gui
  3.  
  4. script.Parent.MouseButton1Click:connect(function()
  5.  
  6. if debounce == 0 then -- checks if the menu is closed
  7. debounce = 1 -- this means the menu is in process of sliding
  8.  
  9. for i = 1,10 do
  10. wait(0.02)
  11. menu.Position = menu.Position + UDim2.new(0.02,0, 0,0) -- this moves the gui
  12. end
  13. debounce = 2 -- this means the menu is open
  14.  
  15. elseif debounce == 2 then -- checks if the menu is open
  16. debounce = 1 -- this means the menu is in process of sliding
  17.  
  18. for i = 1,10 do
  19. wait(0.02)
  20. menu.Position = menu.Position - UDim2.new(0.02,0, 0,0) -- this moves the gui
  21. end
  22. debounce = 0 -- this means the menu is closed
  23.  
  24. end
  25. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement