I'm making a loading screen gui using ContentProvider.RequestQueueSize, even though it's better to used :PreloadAsync(). Well, for some reason RequestQueueSize always returns as 0, for everyone. Even if all the assets haven't loaded
local Frame = script.Parent.LoadingFrame
local PercentLeftLabel = Frame.PercentLeft
local AssetsLeftLabel = Frame.AssetsLeft
local LoadingBar = Frame.LoadingBarFrame
local AllAssetsLoaded = false
local starterGui = game:GetService('StarterGui')
local ContentProviderService = game:GetService("ContentProvider")
local Assets = ContentProviderService.RequestQueueSize
print(ContentProviderService.RequestQueueSize)
print(Assets)
starterGui:SetCore("TopbarEnabled", false)
function CloseGUI()
wait(2)
--Other stuff here ill add later
starterGui:SetCore("TopbarEnabled", true)
script.Parent:Destroy()
end
while AllAssetsLoaded == false do
local Percentage = ContentProviderService.RequestQueueSize/Assets * 100
AssetsLeftLabel.Text = "There are " .. ContentProviderService.RequestQueueSize .. " assets left out of " .. Assets .. " assets."
LoadingBar:TweenSize(UDim2.new(0, Percentage, 0, 5))
PercentLeftLabel.Text = Percentage .. "% Left"
if ContentProviderService.RequestQueueSize == 0 then
AllAssetsLoaded = true
AssetsLeftLabel.Text = "All assets have loaded."
CloseGUI()
elseif ContentProviderService.RequestQueueSize < 0 then
AllAssetsLoaded = true
AssetsLeftLabel.Text = "An error has occured with the loading proccess."
CloseGUI()
end
wait(0.05)
end
its messy ik, how can I fix this, or come up with a different solution?
