Loading assets problem

Hello there! if u reading this then please help me with the loading assets thingy in roblox
this is the code i saw on YT:

for i= 1, #Assets do
	local asset = Assets[i]
	
	ContentProvider:PreloadAsync({asset})
	UIs.Loadin.Loadtext.Text = "Loading ("..i.."/"..#Assets..")"
end

The code works fine, but the later I build my game, the more “assets” it creates. It took quite some time to load the full game, so I came up with a solution: split my game into several places and then teleport player, but then it’s probably not so good for what I am making, so my question: is there other way to load assets that take less time ( like some big games on roblox rn) or a way to load main thing in the game
such as decal, sound, certain parts,…?

It would be really appreciated if you could help.

When it comes to preloading, you should only preload assets that need to be preloaded. The more assets you want to load in before the game starts can sometimes result in a longer loading time. Whenever I use ContentProvider to preload my assets, I only preload the assets I need to such as a few sounds and animations since they can delay sometimes so I preload them so they work instantly.

I add a folder into ReplicatedFirst containing all the assets I want to preload and I also insert a LocalScript into ReplicatedFirst which preloads the assets:

local ContentProvider = game:GetService("ContentProvider")
local ReplicatedFirst = game:GetService("ReplicatedFirst")

local Assets = ReplicatedFirst:WaitForChild("Assets") -- Folder containing animations and sounds

print("Preloading Assets...")
ContentProvider:PreloadAsync(Assets:GetChildren())
print("Assets Loaded!")

Hope this helps.

3 Likes

this is exactly what i’m looking for, thank you :smiley:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.