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 transparency fade?

How would I make a Gui fade?

for trna = 10,0,-1 do
gui.Transparency  = trna

What I am trying to make is a GUI that will fade in and out between each map change of the game.

2 comments

0

Stick a wait and an end, and that'll work

0

I have tried that, it does not work. But I will try again.

1 answer

✓ Accepted answer

Taking on board eLunate's suggestions, your current script looks something like this:

for trna = 10,0,-1 do
gui.Transparency  = trna
wait(1)
end

However, this still won't work. First of all, there is no gui with a property called 'Transparency'. Depending on what type of gui you are using, you'll either want BackgroundTransparency, TextTransparency, ImageTransparency or a combination of the three. If you want your gui to fade in (assuming this is a textbox, for an image box you would swap out 'TextTransparency' for 'ImageTransparency'), this is how:

for trna = 10,0,-1 do
gui.BackgroundTransparency= trna
gui.TextTransparency=trna
wait(1)
end

However, this still won't work because transparency does not count from 0 to 10. It counts from 0 to 1. In order to get your 1/10th interval in, we can simply divide the end number and interval by ten, so you end up with this:

for trna = 1,0,-0.1 do
gui.BackgroundTransparency= trna
gui.TextTransparency=trna
wait(1)
end

Lastly, make sure you have correctly defined where the gui is:

gui = -- Put your gui's location here

This needs to go at the top of your script, so your whole script will look like this:

gui = -- Gui location

for trna = 1,0,-0.1 do
gui.BackgroundTransparency= trna
gui.TextTransparency=trna
wait(1)
end

2 comments

0

1

0

1 Like

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