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

How to make a GUI invisible after loading?

Asked by 10 years ago

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

2) 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

3) 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

Log in to vote
0
Answered by 9 years ago

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! ;)

Ad

Answer this question