Okay so we all know that the best way to script loading screen is, getting all descendants of the game and preloading instances with ContentProvider. But I have a few questions in my head?
Question 1: when we are getting all descendants of the game, like this.
local assets = #game:GetDescendants()
print(assets)
-- Output: 1000-1500
its giving a incomplete result, if we do this and if our game has, assets, models, map etc
if (not game:IsLoaded()) then
game.Loaded:Wait()
end
local assets = #game:GetDescendants()
print(assets)
-- Output: 4000-5000
so which one we should use it? i looked other scripters code. and the all of them using is first way(without waiting the game loads).
Question 2: Should we preload each instances in a loop or it should be loaded just once?
Which one it should be?
1:
local ContentProvider = game:GetService("ContentProvider")
local allAssets = nil --all assets here
for _,v in allAssets do
ContentProvider:PreloadAsync({v})
end
2:
local ContentProvider = game:GetService("ContentProvider")
local allAssets = nil --all assets here
ContentProvider:PreloadAsync(allAssets)