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

How do I make a fading GUI like a loading screen?

Asked by 5 years ago

I have this script right here..

script.Parent.Parent.TextButton.MouseButton1Click:Connect(function()
for loop = 1,10 do
    wait(0.01)
    script.Parent.BackgroundTransparency = loop/10
    game:GetService("RunService").Stepped:Wait()
end
end)

And it makes a frame's "BackgroundTransparency" go from 1 to 0. But how do I make that go from 0 to 1 and then wait for a few seconds and then from 1 back to 0?

Thanks for your time.

0
u should use tweening and not that loop tacotown2 119 — 5y
0
you could use a while loop NathanGaming2005 2 — 5y
0
@tacotown2, Uhhhh... why shouldn't he use a numeric for loop? It's more efficient and he doesn't seem to mind the fade skips. SummerEquinox 643 — 5y
0
tweening is probably smoother and it can easily be customized by changing its tweeninfo, also no idea why line 5 is where it is GoldAngelInDisguise 297 — 5y
0
Listen to taco and Gold. ScriptGuider 5640 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

This is an example of incorrect use of transparency values

gui = -- Gui location

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

So Basically transparency works 0 to 1 not 0 to 10 so divide the end number and interval by ten. I have used "TextTransparency" guessing that whats your using but if its an image you can use "ImageTransparency". Example:

gui = -- Gui location

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

If this helped please up vote and accept answer, lets help each other out

0
He cannot upvote he has 0 reputation LOL WideSteal321 773 — 5y
Ad

Answer this question