Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a GUI fade on click?

Asked by 9 years ago

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?

1Script.Parent.MouseButton1Click:connect (function()
2 
3Script.Parent.Parent.Position.UDim2.new(0+i
4wait()
5 
6script.Parent.TextButton.MouseClick:c­onnect(click)
7end

I know something is wrong, but can't figure it out, anyone know a solution?

0
I'll help you in a moment, I have to wait a minute and a half before posting another answer. ObscureEntity 294 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

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.

01local clicked = false
02local obj = script.Parent -- change to the text button you want's transparency to change
03script.Parent.MouseButton1Down: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
13end)
0
Or if you want to make it less lengthy, you could say "obj.BackgroundTransparency = i/100" CodingEvolution 490 — 9y
0
And you might wanna change that debounce variable back to false at the end of that for loop :p CodingEvolution 490 — 9y
0
These are the errors I'm getting. 01:55:03.328 - This function is not yet enabled! 01:55:05.352 - Workspace.Part.SurfaceGui.Start.TextButton.Script:1: unexpected symbol near '01' 01:55:05.422 - Place has to be opened with Edit button to access DataStores 01:55:05.512 - Workspace.Part.SurfaceGui.uMainPage.TextButton.Script:5: unexpected symbol near 'end Laserpenguin12 85 — 9y
0
nvm it worked, thanks mate Laserpenguin12 85 — 9y
0
That's not a debounce; that's to make it so that they can't click it more than one while it's fading. ObscureEntity 294 — 9y
Ad

Answer this question