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

I need help with my fading GUI. It has already been through a few drafts. May I have some help?

Hello, I would like help with my fading script.

I can't see anything wrong with it and it has been through a few drafts already.

So here it is:

for i = 1, 10 do
	wait(0.1)
	script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency + 0.02
end

Any help would be appreciated!

4 comments

0

What exactly are you having an issue with?

0

Fading in the GUI

0

is it not working or what?

0

Most people do for i = 0, 1 do whatever.BackgroundTransparency = i (or something similar). As for the error itself, are you certain script.Parent.BackgroundTransparency isn't already 1?

1 answer

✓ Accepted answer

You are only looping through 10 times, so the transparency is only reaching 0.2.

Assuming you are starting at 0 transparency and want to fade all the way to fully transparent, you can do something like this:

for i = 0, 1, 0.02 do
	wait(0.1)
	script.Parent.BackgroundTransparency = i
end

The first number is the starting value, the second is the ending value, and the third number is how much you want to increment 'i' each time you pass through the loop.

And we set BackgroundTransparency to i, so it will be fully transparent when the loop ends, since our ending value is 1.

Any questions or confusion? Just ask! Hope this helps.

4 comments

0

Thank you! I will try!

0

It doesn't work :(

0

What's the issue? the answer he replied should work; Have you checked the ZIndex? possibly the DisplayOrder?

0

Sorry, I forgot to mention it was fading in, not out

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