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

Gui problems? Text wont fade out just dissapears.

Just want it so when the game starts up this text fades a bit, then ends. It all fades out for good. Well it starts up and the text just disapears and there is a black background and nothing happens. No errors. So I am pretty sure I should be using a for loop her for the fading I just dont know how. If someone coukld help with this code and explain the whole "For i, v" or whatever it is that would be greatly appreciated. Here is the code:

local gui = script.Parent
while true do
	wait(5)
	repeat gui.Names.Transparency = gui.Names.Transparency + 1 wait(0.3) until gui.Names.Transparency == 1
	gui.Names.Text = "Some game"
	wait(4)
	repeat gui.Names.Transparency = gui.Names.Transparency + 1 wait(0.3) until gui.Names.Transparency == 1
	repeat gui.Black.Transparency = gui.Black.Transparency + 1 wait(0.3) until gui.Black.Transparency == 1
	gui:Destroy()
end

This is in the actual Gui.

2 comments

0

I have a few questions. You have three loops doing the exact same thing. Why? Why not use a for loop with a simple lerping function and lerp the transparency of the text until it is invisible?

0

If you would like I can provide an example using a lerping function.

1 answer

You are adding 1 to the transparency which means you are making it invisible on the first run.

local gui = script.Parent
while true do
    wait(5)
    repeat gui.Names.Transparency = gui.Names.Transparency + .1 wait(0.3) until gui.Names.Transparency == 1
    gui.Names.Text = "Some game"
    wait(4)
    repeat gui.Names.Transparency = gui.Names.Transparency + .1 wait(0.3) until gui.Names.Transparency == 1
    repeat gui.Black.Transparency = gui.Black.Transparency + .1 wait(0.3) until gui.Black.Transparency == 1
    gui:Destroy()
end

Edit: If you want to use "for" then,

local gui = script.Parent
while true do
    wait(5)
    for i=0,1,.1 do gui.Names.Transparency = i wait(.3)  end -- i'm not sure why you changed the transparency to the same thing twice so you could change for i=0,1,.1 to for i=1,0,-.1 to make it appear
    gui.Names.Text = "Some game"
    wait(4)
     for i=0,1,.1 do gui.Names.Transparency = i wait(.3)  end
     for i=0,1,.1 do gui.Black.Transparency = i wait(.3)  end
    gui:Destroy()
end

I didn't test this ;)

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