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

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

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.

5 comments

0

u should use tweening and not that loop

0

you could use a while loop

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.

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

0

Listen to taco and Gold.

1 answer

✓ Accepted answer

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

1 comment

0

He cannot upvote he has 0 reputation LOL

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