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

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

Asked by 5 years ago
Edited 5 years ago

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!

0
What exactly are you having an issue with? TehEp1cFace 59 — 5y
0
Fading in the GUI ProvingTrottle 27 — 5y
0
is it not working or what? starmaq 1290 — 5y
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? Vulkarin 581 — 5y

1 answer

Log in to vote
0
Answered by
Hypgnosis 186
5 years ago

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.

0
Thank you! I will try! ProvingTrottle 27 — 5y
0
It doesn't work :( ProvingTrottle 27 — 5y
0
What's the issue? the answer he replied should work; Have you checked the ZIndex? possibly the DisplayOrder? IDKBlox 349 — 5y
0
Sorry, I forgot to mention it was fading in, not out ProvingTrottle 27 — 5y
Ad

Answer this question