Advertisement
HowToRoblox

Button6Script

Jun 22nd, 2020
2,013
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. local btn = script.Parent
  2. local btnText = btn:WaitForChild("BtnText")
  3.  
  4. local isHovering = false
  5.  
  6. local tweenService = game:GetService("TweenService")
  7. local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)
  8.  
  9. local giveStrokeTween = tweenService:Create(btnText, tweenInfo, {TextStrokeTransparency = 0})
  10. local removeStrokeTween = tweenService:Create(btnText, tweenInfo, {TextStrokeTransparency = 1})
  11.  
  12.  
  13. btn.MouseEnter:Connect(function()
  14.    
  15.     isHovering = true
  16.    
  17.     giveStrokeTween:Play()
  18. end)
  19.  
  20. btn.MouseLeave:Connect(function()
  21.    
  22.     isHovering = false
  23.    
  24.     removeStrokeTween:Play()
  25. end)
  26.  
  27. btn.MouseButton1Down:Connect(function()
  28.    
  29.     removeStrokeTween:Play()
  30. end)
  31.  
  32. btn.MouseButton1Up:Connect(function()
  33.    
  34.     if not isHovering then
  35.         removeStrokeTween:Play()
  36.     else
  37.         giveStrokeTween:Play()
  38.     end
  39. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement