Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make buttons have click animation?

Asked by 6 years ago

I saw this somewhere ,and I really want it, so that when you click a button just like in the gif, it does that cool blue thing! Can anybody help me?

https://gyazo.com/76034f89e68a0ba72fcdaf9697abd312

0
The GuiButton's MouseButton1Down passes where the player clicked (x, y) as its argumets. Combine this with ClipsDescendants and a circle that's tweened to expand, positioned at where the user clicks. XAXA 1569 — 6y

1 answer

Log in to vote
2
Answered by 6 years ago
Edited 6 years ago

FIrst, You create an ImageLabel that is set to a circle image. Then you set the AnchorPoint of the ImageLabel to {0.5,0}, {0.5,0}

Then, Set the parent of the ImageLabel to the button and set ClipsDescendants of the button to true and then when the MouseButton1Down is fired for the button take the x and y values from the event and set the position of the ImageLabel to {0, x}, {0,y} and then use TweenSize(UDim2.new(2,0,2,0), EasingDuration, EasingStyle, Duration) to make the circle grow and set the ImageLabel.Visible = false and ImageLabel.Transparency = 0 at the end of the Tween with the callback function.

And Finally, Under the Tweening code use a for loop to increase the Transparency to 1 over the time of the Duration You can do that by using wait(Duration/LoopIncrement)

Ad

Answer this question