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

My loading gui stops working if something fails to load once?

Asked by 4 years ago

Hello, i have made a loading gui in my game that, once the game fully loads, dissapears, however, if something fails to load, the gui stops working even if the game fully loads Here is my code:

01local frame = script.Parent.Frame
02local base = frame.Base
03local bar = base.Bar
04local indicator = base.Indicator
05local skip = base.Skip
06local queue = game.ContentProvider.RequestQueueSize
07 
08game:GetService("RunService").Stepped:Connect(function()
09    indicator.Text = "Loading Assets... (" .. queue .. ")"
10    bar.Size = UDim2.new(1/queue, 0, 1, 0)
11    if queue == 0 then
12        indicator.Text = "Assets Loaded!"
13        bar.Size = UDim2.new(1, 0, 1, 0)
14        wait(1)
15        frame:TweenPosition(UDim2.new(0, 0, 1, 0))
16    end
17end)

can anyone help me here???

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

When using parentheses, you need to make it a long string. Here:

01local frame = script.Parent.Frame
02local base = frame.Base
03local bar = base.Bar
04local indicator = base.Indicator
05local skip = base.Skip
06local queue = game.ContentProvider.RequestQueueSize
07 
08game:GetService("RunService").Stepped:Connect(function()
09    indicator.Text = [[Loading Assets... (]] .. queue .. [[)]]
10    bar.Size = UDim2.new(1/queue, 0, 1, 0)
11    if queue == 0 then
12        indicator.Text = "Assets Loaded!"
13        bar.Size = UDim2.new(1, 0, 1, 0)
14        wait(1)
15        frame:TweenPosition(UDim2.new(0, 0, 1, 0))
16    end
17end)
Ad

Answer this question