RequestQueueSize only returns 0

While I know that using requestqueuesize for a loadbar is not recommended, it works(ed) well for my game. However, recently it will only return a number of 0, despite the game obviously loading for players. For my loadscreen, it is supposed to show the percentage ‘loaded’, then show an intro and go to a menu. However, it has to wait for a remote event that determines which menu players get. Since the requestqueuesize is returning 0, players are getting stuck on the intro screen, which is waiting for a remote event that hasn’t loaded because the game is in fact still loading. Any ideas why I’m getting a requestqueuesize of 0? I’ve tried it on my PC, and I’ve had a friend with really slow internet try it, and it still returns a value of 0. Here’s a snippet of the code that does the loading percentage:

while content.RequestQueueSize > 0 and skiploading == false do
wait(1)
count = count + 1
if content.RequestQueueSize > original then original = content.RequestQueueSize 
end
fraction = original - content.RequestQueueSize
gui.Info.Text = "Loading: "..math.floor((fraction/original)*100) .."%"
if count > 20 then
gui.Skip:TweenPosition(UDim2.new(0.4,0,0.905,0))
end
end
1 Like

Make sure the script is a local script in the replicated first, and make sure that you call this before anything else in the script.

game:GetService("ReplicatedFirst"):RemoveDeafultLoadingScreen()

Both are already done. Thats I think the third line in the script.

Roblox outlined not to use RequestQueueSize as a way to create a loading bar. It could be possible that the RequestQueueSize is zero when a player first joins or during downtimes when loading assets.

You should look into the code snippet they have on this website to understand a more reliable method for loading content. But I would reccomend you only use PreloadAsset for important objects, you can always use game:IsLoaded to understand if the client has gotten all game content sent to their client.

Developers are advised not to use RequestQueueSize to create loading bars. This is because the queue size can both increase and decrease over time as new assets are added and downloaded. Developers looking to display loading progress should load assets one at a time (see example below).

1 Like

Make sure its the first line, because lines above it can yield the function.
Also, make sure you test when you publish in the game because it will not work in studio.

Yeah I know its not advised, but I like being able to give players a count of whats loading. I thought about using PreloadAsset but for my game it won’t work like I’d like. I could use IsLoaded but again, that doesn’t show any sort of progress.

Tried both, no change. Thanks for the suggestion though.