I want to make a for loop that it increases the transparency of GUI until it is invisible. Can someone give me the code or explain to me how to do it?
✓ ANSWER ACCEPTED
How do I make a for loop that it increases the transparency of a GUI until it is invisible?
2 answers
✓ Accepted answer
We start the for loop at 0 and make it go to 1 at a rate of .01 per wait()
function run()
for i=0, 1, .01 do
ui.Transparency=i
wait()
end
end
button.MouseButton1Click:Connect(run)
Transparency is a number from 0 to 1 so we need to slowly increase the number to see a result, hence the .01
This is basically it just add some more stuff if you have more frames or textlabels or that stuff and the condition and yeah.
local ScreenGUI = script.Parent
local frame = ScreenGUI.Frame
local TextLabel = frame.TextLabel
for i = 1, 10, 1 do
frame.BackgroundTransparency = frame.BackgroundTransparency + 0.1
TextLabel.BackgroundTransparency = TextLabel.BackgroundTransparency + 0.1
TextLabel.TextTransparency = TextLabel.TextTransparency + 0.1
wait(0.1)
end
If you have any questions ask in the comments
2 comments
0
How can I make it so when I click a button on the Gui it plays this script?
0
How can I make it so when I click a button on the gui it plays this script?
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
How can I make it so when I click a button on the gui it plays this script?
@AwesomeMrBird Edited answer