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.
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!