Loading Screen Not Working


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?

For that, on the script I gave you where it says:

text.Text = "[".. i .. " / "..#Assets.."]"

I believe line 23 (Not sure)

Change it to:

text.Text = "[".. i .. " / "..#Assets.."] Asset:" .. Asset.Name

Basically just add .. Asset.Name to the end

Not quite sure, but I believe there should be.

1 Like

Nevermind, it worked. Thank you!

After the for loop, you can make it go to one.

how would i make it tween the frame once the game is loaded?

As you’d like, if you want it to go to the very end, a simple solution would be

for i = 1, #Assets do
-- vrooom vrooom code
end)

wait(1)

barImg.Size = UDim2.new(99, 99, 99, 99) -- :flushed: