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

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

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:

local frame = script.Parent.Frame
local base = frame.Base
local bar = base.Bar
local indicator = base.Indicator
local skip = base.Skip
local queue = game.ContentProvider.RequestQueueSize

game:GetService("RunService").Stepped:Connect(function()
	indicator.Text = "Loading Assets... (" .. queue .. ")"
	bar.Size = UDim2.new(1/queue, 0, 1, 0)
	if queue == 0 then
		indicator.Text = "Assets Loaded!"
		bar.Size = UDim2.new(1, 0, 1, 0)
		wait(1)
		frame:TweenPosition(UDim2.new(0, 0, 1, 0))
	end
end)

can anyone help me here???

1 answer

✓ Accepted answer

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

local frame = script.Parent.Frame
local base = frame.Base
local bar = base.Bar
local indicator = base.Indicator
local skip = base.Skip
local queue = game.ContentProvider.RequestQueueSize

game:GetService("RunService").Stepped:Connect(function()
    indicator.Text = [[Loading Assets... (]] .. queue .. [[)]]
    bar.Size = UDim2.new(1/queue, 0, 1, 0)
    if queue == 0 then
        indicator.Text = "Assets Loaded!"
        bar.Size = UDim2.new(1, 0, 1, 0)
        wait(1)
        frame:TweenPosition(UDim2.new(0, 0, 1, 0))
    end
end)

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