I want to make a Text Button fade in upon first click and fade out when you click it again. i have tried many solutions but i cant get the button to fade in when i click it i can only get it to fade out.
✓ ANSWER ACCEPTED
how would i make a button that fades in when i click it and fades out when i click it again?
1 answer
✓ Accepted answer
Do this:
local button = script.Parent
local debounce = false
local faded = false
button.MouseButton1Click:Connect(function()
if debounce == false then
debounce = true
if faded == false then
faded = true
for i = 0, 1, 0.05 do
button.BackGroundTransparency = i
button.TextTransparency = i
wait(.05)
debounce = false
end
return -- returning to the begenning of the function to not run the following lines after setting "faded" to true
else -- if faded = true
faded = false
for i = 1, 0, -0.05 do
button.BackGroundTransparency = i
button.TextTransparency = i
wait(.05)
end
debounce = false
end
end
end)
This code has to be inserted in a localscript, inside the button you want the player to click.
Hope this helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
I do not currently have any code for this.
please follow https://scriptinghelpers.org/help/how-post-good-questions-answers