Loading Screen Not Working

Hi! What is wrong with my Loading GUI? Thanks!

local text = script.Parent.Frame.Frame.TextLabel.Text
local barImg = script.Parent.Frame.Frame.ImageLabel

script.Parent.Loadin1.barImg:TweenSize(UDim2.new(1, 0, 1, 0), "Out", "Linear", 25, true)
while wait (0.05) do
	local Loading = 35000
	Loading -= 214
	text = "Loading Workspace ("..Loading..")"
	
end

No errors in output

5 Likes

try this. I don’t really have any time to explain as I’m about to go:

local text = script.Parent.Frame.Frame.TextLabel
local barImg = script.Parent.Frame.Frame.ImageLabel

script.Parent.Loadin1.barImg:TweenSize(UDim2.new(1, 0, 1, 0), "Out", "Linear", 25, true)
local Loading = 35000
while wait (0.05) do
	Loading -= 214
	text.Text = "Loading Workspace ("..Loading..")"
	
end
2 Likes

What are you trying to achieve with this part?

1 Like

that’s the same code

2 Likes

decrease number and adjust text

1 Like

It’s not the same code. text.Text is the difference.

2 Likes
while wait (0.05) do

This will make it go on infinitely. You don’t want that.

Try something like…

for i = 0, 50, 1

or something like that.

2 Likes

it still does nothing… also the bar just goes invisible

2 Likes

If you’re trying to tween this:

You didn’t encase it inside the loop, you only just Tweened it once and that’s it

I would also recommend learning about how PreloadAsync can work to efficiently make a loading screen

Oh yeah you also keep setting your Loading variable back to 35000 every time

You should implement sanity checks as well for when the loading is done:

local text = script.Parent.Frame.Frame.TextLabel
local barImg = script.Parent.Frame.Frame.ImageLabel
local Loading = 35000

script.Parent.Loadin1.barImg:TweenSize(UDim2.new(1, 0, 1, 0), "Out", "Linear", 25, true)
while true do
	Loading -= 100
	text.Text = "Loading Workspace ("..tostring(Loading)..")"
    wait(0.05)
    if Loading == 0 then
         break --This will correctly break the loop & you can remove/invisible the frame
    end
end
1 Like

If anything, I would the ContentProvider.RequestQueueSize

1 Like


That also didn’t wpork

2 Likes

There was another post stating on why text does not work, and that is because it stores the old value of the text, say your text was “hello” and you made a variable on it,

local text = script.Parent.Frame.Frame.TextLabel.Text

when the script runs, it saves this as a variable, it sees you are looking for the text so it then sees “hello” and then that is what the variable saves,so this is an important factor to this script, here is the link to a post something like this: :happy2:

Link

TextLabel not showing text

ALSO BIG THING, TRY CHANGING “Out” to

Enum.EasingDirection.Out

and

Enum.EasingStype.Linear

another thing is that your loop does not have a
wait()
nor does it include a
break
you may have included it after while but that is just like saying while true do
I don’t know how to explain this but i hope this helps!

1 Like

Hiya! :wave:

Try checking out: ContentProvider
This might be useful

Example script with ContentProvider:

local Assets = {} -- All the assets you want to load

local text = script.Parent.Frame.Frame.TextLabel.Text
local barImg = script.Parent.Frame.Frame.ImageLabel

for i = 1, #Assets do
	local Asset = Assets[i]
	text.Text = "[".. i .. " / "..#Assets.."]" 
        ContentProvider:PreloadAsync({Asset})
	
	local Progress = i / #Assets
	barImg:TweenSize(UDim2.new(Progress, 0, 1, 0), Enum.EasingDirection.In, Enum.EasingStyle.Sine, 1, false)
	wait(0.1)
end
3 Likes

The only other thing that I see is that you aren’t repeatedly tweening your LoadingBar if it’s an actual bar

Either that or you’re doing this on a server script

local text = script.Parent.Frame.Frame.TextLabel
local barImg = script.Parent.Frame.Frame.ImageLabel
local Loading = 35000
script.Parent.Loadin1.barImg:TweenSize(UDim2.new(1, 0, 1, 0), "Out", "Linear", 25, true)

while true do
	Loading -= 100
	text.Text = "Loading Workspace ("..tostring(Loading)..")"
    script.Parent.Loadin1.barImg:TweenSize(UDim2.new(Loading / 35000, 0, 1, 0), "Out", "Linear", 25, true)
    wait(0.05)
    if Loading == 0 then
         break --This will correctly break the loop & you can remove/invisible the frame
    end
end
1 Like

Would the example of Assets be:

game.Workspace, game.ServerScriptService, “game.Workspace”, “game.ServerScriptService”, or “workspace.City”, game?

or 22500?
also image

1 Like

Yep, you can!

ContentProvider basically preloads an asset When using the :PreloadAsync function
ContentProvider is also service, make sure you use:

local ContentProvider = game:GetService("ContentProvider")

So what set can I use?\

What one?

The second one (I believe), here’s an example using your examples:

local Assets = {

game.Workspace,
game.ServerScriptService

}

Not quite sure what you meant with “22500”, did you re-name a service to that?


it did nothing, WTH??

local Assets = {
	game.StarterGui,
	game.Workspace,
	game.ServerScriptService,
	game.Players,
	game.NetworkClient,
	game.ReplicatedFirst,
	game.ReplicatedStorage,
	game.ServerStorage,
	game.StarterPack,
	game.StarterPlayer,
	game.Teams,
	game.SoundService,
	game.Chat,
	game.LocalizationService
} 

local text = script.Parent.Frame.Frame.TextLabel.Text
local barImg = script.Parent.Frame.Frame.ImageLabel
local ContentProvider = game:GetService("ContentProvider")

for i = 1, #Assets do
	local Asset = Assets[i]
	text.Text = "[".. i .. " / "..#Assets.."] Loading Asset: " .. ContentProvider:PreloadAsync({Asset})

	local Progress = i / #Assets
	barImg:TweenSize(UDim2.new(Progress, 0, 1, 0), Enum.EasingDirection.In, Enum.EasingStyle.Sine, 1, false)
	wait(0.1)
end
1 Like

Have you tried checking the output/console, if so could you send a screenshot of it?