So, I've tried to make a code to make my GUI fade on the click of a text button, here's what I have so far, but it doesn't work, what am I missing?
1 | Script.Parent.MouseButton 1 Click:connect ( function () |
2 |
3 | Script.Parent.Parent.Position.UDim 2. new( 0 +i |
4 | wait() |
5 |
6 | script.Parent.TextButton.MouseClick:connect(click) |
7 | end |
I know something is wrong, but can't figure it out, anyone know a solution?
Alright. You said you want your text button to 'fade' away. Im assuming you mean changing the transpareny; but in your example you're changing the position.
01 | local clicked = false |
02 | local obj = script.Parent -- change to the text button you want's transparency to change |
03 | script.Parent.MouseButton 1 Down:connect( function () -- put this script in the button that needs to be clicked |
04 |
05 | if clicked = = false then |
06 | clicked = true |
07 | for i = 1 , 100 do |
08 | obj.BackgroundTransparency = obj.BacgroundTransparency - 0.01 |
09 | obj.TextTransparency = obj.TextTransparency - 0.01 |
10 | wait() |
11 | end |
12 | end |
13 | end ) |