0 views0 copies0 likes
Button Press Animation with UIScale
Universal script
Copy it, then test it in your own Studio place.
Script code
21 lines ยท 0.8 KBlocal TweenService = game:GetService("TweenService")local button = script.Parentlocal scale = button:FindFirstChildOfClass("UIScale") or Instance.new("UIScale", button)local size = scale.Scalelocal tween, clickId = nil, 0local function resize(goal, seconds) if tween then tween:Cancel() end tween = TweenService:Create(scale, TweenInfo.new(seconds, Enum.EasingStyle.Quad), {Scale = goal}) tween:Play()endbutton.MouseButton1Down:Connect(function() resize(size * 0.92, 0.06) end)button.MouseButton1Up:Connect(function() resize(size, 0.14) end)button.SelectionLost:Connect(function() resize(size, 0.14) end)button.Activated:Connect(function()-- โฆopen Get script for the full sourceAbout this script
Add this LocalScript inside an ImageButton or TextButton. It inserts a UIScale if needed, shrinks the button when pressed, and returns it to its original scale with a short easing tween. Rapid changes cancel the previous tween, and tapping also triggers a short press. Attach your gameplay handler separately and test the animation with keyboard, mouse and touch.
Log in to leave a comment.
No comments yet
Be the first to share your thoughts!
Comments
Share what works, ask questions, or report an issue.