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

How to make a GUI invisible after loading?

I made a loading GUI. I want to make it invisible after it has loaded. this is the basic script that loads the GUI:

for i = 0,100,1 do
script.Parent.PercentLabel.Text = "Progress: " .. math.floor(i) .. "%"
script.Parent.Scroll.Size = UDim2.new(0, i*4, 0, 40)
wait(math.random(0.08,0.80))
end

I have tried a few ways how to make it invisble after loading:

  1. Gui Size method:
for i = 0,100,1 do
script.Parent.PercentLabel.Text = "Progress: " .. math.floor(i) .. "%"
script.Parent.Scroll.Size = UDim2.new(0, i*4, 0, 40)
wait(math.random(0.08,0.80))
if script.Parent.Loading.Size = {0,400},{0,40}then
	script.Parent.Visible = false
end
end
  1. Text Method:
for i = 0,100,1 do
script.Parent.PercentLabel.Text = "Progress: " .. math.floor(i) .. "%"
script.Parent.Scroll.Size = UDim2.new(0, i*4, 0, 40)
wait(math.random(0.08,0.80))
if script.Parent.PercentLabel.Text = "Progress: 100%"then
	script.Parent.Visible=false
end
end
  1. Wait Method:
for i = 0,100,1 do
script.Parent.PercentLabel.Text = "Progress: " .. math.floor(i) .. "%"
script.Parent.Scroll.Size = UDim2.new(0, i*4, 0, 40)
wait(math.random(0.08,0.80))
wait(55)
script.Parent.Visible = false
end

None of these methods work, in fact the wait method broke the script! Can some one help me with this?

1 answer

We can't make a GUI invisible. All we can is to make all the containing things invisible. We use Transparency to make the GUI's containing things to become invisible.

for i = 0,100,1 do
script.Parent.PercentLabel.Text = "Progress: " .. math.floor(i) .. "%"
script.Parent.Scroll.Size = UDim2.new(0, i*4, 0, 40)
wait(math.random(0.08,0.80))
if script.Parent.Loading.Size = {0,400},{0,40}then
script.Parent.PercentLabel.Text.Transparency = 1 -- Makes the text invisible.
end
end

And if your GUI has a Frame, we use Visible to make it visible or not.

for i = 0,100,1 do
script.Parent.PercentLabel.Text = "Progress: " .. math.floor(i) .. "%"
script.Parent.Scroll.Size = UDim2.new(0, i*4, 0, 40)
wait(math.random(0.08,0.80))
if script.Parent.Loading.Size = {0,400},{0,40}then
script.Parent.PercentLabel.Text.Transparency = 1 -- Makes the text invisible then the frame too.
script.Parent.Frame.Visible = false
end
end

Hope it will help! ;)

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