I have a loading bar script that loads every Descendant of the game.
It does work, however, the percentage seems to be really off, and it takes way too long for the script to “load” the game when it’s already loaded.
I’ve looked for different methods to load the player’s game more efficiently, but couldn’t find anything. I think I’m missing something.
I want to improve the code by loading the game more efficiently because I think it’s loading assets that have already been loaded, which is why it takes so long.
local assets = game:GetDescendants()
local Bar = LoadingScreen.Bar
local barText = Bar.TextLabel
for i = 1, #assets do
local asset = assets[i]
local percentage = math.round(i / #assets * 100)
if asset:IsA("Folder") then
barText.Text = asset.Name.."..."
end
print(percentage)
TS:Create(Bar, TweenInfo.new(0.2, Enum.EasingStyle.Sine), {Size = UDim2.fromScale(percentage/100, 0.025)}):Play()
ContentProv:PreloadAsync({asset})
end
Here is a visual representation to get a better understanding:
The numbers below are the percentage of the game that has been loaded. And you can see how low it is seeing as everything looks already loaded!