Loading Screen Not Working

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 | Roblox Creator Documentation
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?


local Assets = {
	gameGetService("Workspace"),
	gameGetService("Players"),
	gameGetService("NetworkClient"),
	gameGetService("ReplicatedFirst"),
	gameGetService("ReplicatedStorage"),
	gameGetService("ServerStorage"),
	gameGetService("StarterPack"),
	gameGetService("StarterPlayer"),
	gameGetService("Teams"),
	gameGetService("SoundService"),
	gameGetService("Chat"),
	gameGetService("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.."]"
        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

Try this ^^

Note: You don’t quite need to preload ServerScriptService as you’re preloading assets on a client-sided script, meaning you aren’t quite preloading everything inside ServerScriptService.

I had it loading StarterGUI first because I want the UI to load and tween, While I try that, how would I make the logokind of bounce up, and then have the second frame tween after, and then start loading everything else?

Great, we got somewhere! I would want it to say “Loading Workspace (1/12)”, and to have the bar go 100%.

When preloading StarterGUI, you’re not quite preloading the players GUI’s specifically, try using this path to the players GUI:

local Player = game:GetService("Players").LocalPlayer -- Since this is on a local script aka client sided script, we can just use .LocalPlayer
local Assets = {
   Player:WaitForChild("PlayerGui")
} 

And for the bounce affect you can use what we’ve been using this whole time for the progress bar, which was TweenService | Roblox Creator Documentation

How would I make it bounce, is there a preset for that?