OnFireRobloxScriptin

Hover Effect Localscript

Oct 19th, 2025
1,914
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. --//Services
  2. local tweenService = game:GetService("TweenService")
  3.  
  4. --//Variables
  5. local ui = script.Parent
  6. local originalSize = ui.Size
  7. local originalPosition = ui.Position
  8. local hoverSizeIncrease = UDim2.new(0.01, 0, 0.01, 0)
  9. local hoverSize = originalSize + hoverSizeIncrease
  10. local hoverPosition = originalPosition - UDim2.new(hoverSizeIncrease.X.Scale / 2, 0, hoverSizeIncrease.Y.Scale / 2, 0)
  11. local tweenTime = 0.2
  12.  
  13. --//Tweens
  14. local hoverTween = tweenService:Create(ui, TweenInfo.new(tweenTime), {Size = hoverSize, Position = hoverPosition})
  15. local leaveTween = tweenService:Create(ui, TweenInfo.new(tweenTime), {Size = originalSize, Position = originalPosition})
  16.  
  17. ui.MouseEnter:Connect(function()
  18.     hoverTween:Play()
  19. end)
  20.  
  21. ui.MouseLeave:Connect(function()
  22.     leaveTween:Play()
  23. end)
Advertisement
Add Comment
Please, Sign In to add comment