Hi, I'm making a loading GUI, when something is loaded with the ContentProvider then the loading bar of the GUI gets bigger, but this is not the case. The loading bar remains miniscule, even so small that you can't see it with the naked eye. Does anyone know how else to do it? There are no errors in my output.
Code:
local ReplicatedFirst = game:GetService("ReplicatedFirst")
ReplicatedFirst:RemoveDefaultLoadingScreen()
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local LoadingGui = script.LoadingGui
LoadingGui.Parent = PlayerGui
local MainFrame = LoadingGui.MainFrame
local LoadingBar = MainFrame.LoadingBar
local Bar = LoadingBar.Bar
local ContentProvider = game:GetService("ContentProvider")
local AssetsLoaded = 0
local AssetsToLoad = game:GetDescendants()
for _,V in ipairs(AssetsToLoad) do
ContentProvider:PreloadAsync({V})
AssetsLoaded += 1
Bar.Size = UDim2.new(1/AssetsLoaded, 0, 1, 0)
end
LoadingGui:Destroy()

1 comment
change the first parameter for the bar's size to AssetsLoaded / #AssetsToLoad