Main Menu Gui Button Sizing Issues

Hello community,
I have recently made a Main Menu Gui with the help of a tutorial. The past day or so I’ve spent customizing it / learning the script and decided to make it so the buttons would change size when hovered over with a mouse.

The issue:
Though the function works it doesn’t work well when a player enters and leaves the button rapidly resulting the button Gui to stay one size.

Solutions that i’ve tried:

  • Adding a wait
  • Adding an if statement

Conclusion:
Any help is appreciated especially since I am somewhat new to scripting and don’t have a firm understanding quite yet.

Here’s the script:

2 Likes

I have found that this way isn’t very efficient. What I do is add a debounce to the MouseEntered event and don’t check for when the player’s mouse leaves the button, but if their mouse isn’t over the button and then descale it. The problem with doing it that way is the events interfere with eachother.

1 Like

Thanks a ton, Ill be sure to implement this ASAP.
Note: Apologies for the late response!

The problem is the time it takes to tween your UI objects. Reduce it to something lower. It won’t look as smooth all the time, but it works.

1 Like

I had after posting this, still does it, however is far less noticable. Thanks for the help!

I found a solution to the issue! Though I had tried both of the solutions below (Thanks a ton still!) I found an discussion that said I needed to add a “true” to the end of the tweens. Works like a charm now, thanks for the help everyone!