Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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?

0
Will the percentage be a loading bar or just numbers (50%) PepeElToro41 132 — 3y
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. gamernight687 138 — 3y
0
ohh i see you can do game.Workspace:GetDescendants() and this returns all the children inside PepeElToro41 132 — 3y

1 answer

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
3 years ago

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
0
Thank you so much! I now understand it much better! gamernight687 138 — 3y
Ad

Answer this question