Advertisement
HowToRoblox

Button4Script

Jun 22nd, 2020
5,276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. local btn = script.Parent
  2.  
  3. local isHovering = false
  4.  
  5. btn.MouseEnter:Connect(function()
  6.    
  7.     isHovering = true
  8.    
  9.     btn:TweenSize(UDim2.new(1.03, 0, 1.091, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
  10. end)
  11.  
  12. btn.MouseLeave:Connect(function()
  13.    
  14.     isHovering = false
  15.    
  16.     btn:TweenSize(UDim2.new(1, 0, 1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
  17. end)
  18.  
  19. btn.MouseButton1Down:Connect(function()
  20.    
  21.     btn:TweenSize(UDim2.new(0.97, 0, 0.909, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
  22. end)
  23.  
  24. btn.MouseButton1Up:Connect(function()
  25.    
  26.     if not isHovering then
  27.         btn:TweenSize(UDim2.new(1, 0, 1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
  28.     else
  29.         btn:TweenSize(UDim2.new(1.03, 0, 1.091, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
  30.     end
  31. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement