I’m releasing my ANIMATE Module for GUI
local TweenService = game:GetService("TweenService")
local module = {}
local function animateButton(button)
local originalSize = button.Size
local hoverMultiplier = 1.15
local clickMultiplier = 0.9
local function calculateSize(originalSize, multiplier)
local newSizeX = originalSize.X.Scale * multiplier
local newSizeY = originalSize.Y.Scale * multiplier
local newOffsetX = originalSize.X.Offset * multiplier
local newOffsetY = originalSize.Y.Offset * multiplier
return UDim2.new(newSizeX, newOffsetX, newSizeY, newOffsetY)
end
local hoverSize = calculateSize(originalSize, hoverMultiplier)
local clickSize = calculateSize(originalSize, clickMultiplier)
local function animateSize(targetSize)
local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local tween = TweenService:Create(button, tweenInfo, {Size = targetSize})
tween:Play()
end
button.MouseEnter:Connect(function()
animateSize(hoverSize)
end)
button.MouseLeave:Connect(function()
animateSize(originalSize)
end)
button.MouseButton1Down:Connect(function()
animateSize(clickSize)
end)
button.MouseButton1Up:Connect(function()
animateSize(hoverSize)
end)
end
module.animateButton = animateButton
return module
PREVIEW:
HOW TO USE:
Copy the script I proved above, make a module in replicated storage, name it whatever u want, then go to the gui/button you want to animate, create a local script, paste this code:
local TweenModule = require(game.ReplicatedStorage["NAME"])
TweenModule.animateButton(script.Parent)
thanks!