Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I display the percentage of the game being loaded in a GUI?

Hi, I was making a loading screen, and after months of making simple loading screens, I decided I wanted to learn how to display the accurate percentage of the game being loaded in a GUI. I would like to know, is there a certain function, or method you can use to achieve this?

3 comments

0

Will the percentage be a loading bar or just numbers (50%)

0

You can just do the loading bar for this question's sake, the main reason im asking is so I know what the function to find the objects loading in the game.

0

ohh i see you can do game.Workspace:GetDescendants() and this returns all the children inside

1 answer

✓ Accepted answer

Based on roblox wiki, you should try to preload each asset at a time, yelding while it is loading:

(code from roblox devhub)

-- create some sample assets
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://301964312"
local sound2 = Instance.new("Sound")
sound2.SoundId = "rbxassetid://301964312"
 
-- create a table of assets to be loaded
local assets = {
	sound,
	sound2
}
 
wait(3)
 
for i = 1, #assets do
	local asset = assets[i]
	ContentProvider:PreloadAsync({asset}) -- 1 at a time, yields
	local progress = i / #assets
	bar.Size = UDim2.new(progress, 0, 1, 0)
end

1 comment

0

Thank you so much! I now understand it much better!

This discussion is preserved as it was. New answers, comments, and votes are closed.