Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a GUI fade on click?

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?

Script.Parent.MouseButton1Click:connect (function()

Script.Parent.Parent.Position.UDim2.new(0+i
wait()

script.Parent.TextButton.MouseClick:c­onnect(click)
end

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

1 comment

0

I'll help you in a moment, I have to wait a minute and a half before posting another answer.

1 answer

✓ Accepted answer

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.

local clicked = false
local obj = script.Parent -- change to the text button you want's transparency to change
script.Parent.MouseButton1Down:connect(function() -- put this script in the button that needs to be clicked
	
	if clicked == false then
		clicked = true
		for i = 1,100 do
			obj.BackgroundTransparency = obj.BacgroundTransparency - 0.01
			obj.TextTransparency = obj.TextTransparency - 0.01
			wait()
		end
	end
end)

5 comments

0

Or if you want to make it less lengthy, you could say "obj.BackgroundTransparency = i/100"

0

And you might wanna change that debounce variable back to false at the end of that for loop :p

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

0

nvm it worked, thanks mate

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.