MouseEnter Button Fade?

How would I set the transparency of a textbutton from 1-0 smoothly upon my mouse entering the button (Preferably w/ a for loop as I’d like to learn more about them. :))?

You should try using tweens instead, they’re pretty useful in making things appear smooth with the use of easing styles :smiley:

I would, but I’m trying to make the game eerie kinda and it doesn’t really fit what I’m attempting. :slight_smile:

TweenService is the way to go! :slightly_smiling_face:

You’ll want to use the event .MouseEnter as you said and tween the transparency using Tween.Create

local TweenService = game:GetService("TweenService")
local Item = Button
local info =
	local goals = {
			ImageTransparency = 1
local Animate = TweenService:Create(Item,info,goals)

You can change the easing style to try to cater what you want to try out.


Could you explain in more detail of what you’re trying to attempt?
It would help us to help you more if we understood.

(sorry if that sounded a bit off…)

You may need to make use of RenderStepped event on RunService.

Basically, instead of using one while loop with 10 lines, and 10 wait()'s to change the transparency of the TextButton, I want to do it w/ a for loop as I feel as it’s much more efficient.

Hmmm, I don’t think loops are the best way to go, since you’re also using MouseEnter to make it happen which can appear VERY glitchy. Instead, you can use a plugin that changes tweens :smiley:

^^^ Will be very handy in trying to create your own “custom” tweens :stuck_out_tongue:


I’ll attempt this one, thanks both of you! (:


Your welcome! Glad to help :smiley:

Or… you could do

for i = 1,0,-.1 do
TextButton.BackgroundTransparency = i
TextButton.TextTransparency = i

Yes you could do that but since its MouseEnter, hovering on and off it quickly can make it looks very glitchy and odd.

Could make a boolean that checks if the transparency is 0/1 so the code wouldn’t run again so fast.

Thats true but, that could cause a noticeable delay in the fade wouldn’t it?

I’ll actually be using this one, works well! Thank you Hoan and Jordy also. :slight_smile:


Your welcome! Glad to help you :stuck_out_tongue:
Good luck on developing your game btw!

Thank you! Good luck on your project(s) aswell!

You should use TweenService as uJordy posted. The “tween” listed as the solution can’t be overwritten and if you try, it’d appear “glitchy”. Using a Boolean to debounce it wouldn’t be appropriate either, because then it wouldn’t give you the kind of effect that you desire.

Tweens made from TweenService can be overwritten (and automatically too) if you play a tween overtop it. You get the effect you want and you don’t get the overhead of having to account for any extraneous or unnecessary behaviour.

Tweens for aesthetic over iteration are definitely the way to go.

1 Like