Recently, I’ve noticed that more games are including [Prototype A] rather than [Prototype B]. I’m wondering how it’s accomplished; With the number of assets loaded, how can you script the UI? How do you get the assets to load as well? So, instead of putting in a bar that appears to be loading, how can I certainly make [Prototype B]? Because I’ve browsed the DevForum and the Developer Roblox Hub for them and haven’t discovered any results yet. I essentially want to display the number of assets and what is being loaded.
I only know this script, which I’ve found on the Developer Roblox Hub:
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
-- Remove the default loading screen
ReplicatedFirst:RemoveDefaultLoadingScreen()
--wait(3) -- Optionally force screen to appear for a minimum number of seconds
if not game:IsLoaded() then
game.Loaded:Wait()
end
I’ve attached two images below showcasing the prototypes!
I am well aware! Thank you for bringing this to my attention. But do you mean that there isn’t a way for me to demonstrate how the assets are loaded and so on? Since some games do have [Prototype A], and it’s different every time (not math.random) (tested via wifi), it’s presumably legit. So I’m beginning to wonder if the ones comparable to it are real because they always finish loading at various times and when the loading disappears, it ensures that the game’s assets have been loaded.
local con = game:GetService("ContentProvider")
local loaded = 0 -- assetsLoaded
local allassets = #game.Workspace:GetChildren() -- amount of assets
for _,v in pairs(game.Workspace:GetChildren()) do -- assets to load
con:PreloadAsync({v})
loaded+= 1
print(loaded.."/"..allassets)
end
print("all Done") -- all assets are loaded
Thank you so much for this. However, where should the script be posted in? Should this be in a LocalScript or in a normal Script, and where should it be placed? This does work just fine as well. I think this can be implemented into GUI.
As far as I know, there is no easy way to know how many assets associated instances (and asset ids in general) in ‘contentIdList’ you are providing into PreloadAsync function unless you know that it’s just a list of assets associated instances.
So what you will end up with implementing it is something like this:
local ContentProvider = game:GetService("ContentProvider")
local assetsAssociatedInstances = {}
local function extendAssetsAssociatedInstances(children)
table.move(children, 1, #children, #assetsAssociatedInstances + 1, assetsAssociatedInstances)
end
extendAssetsAssociatedInstances(PATH_TO_SOUNDS_FOLDER:GetChildren())
extendAssetsAssociatedInstances(PATH_TO_MODELS_FOLDER:GetChildren())
extendAssetsAssociatedInstances(PATH_TO_UI_ASSETS_FOLDER:GetChildren())
local totalAmountOfAssetsAssociatedInstances = #assetsAssociatedInstances
local currentAmountOfPreloadedAssets = 0
ContentProvider:PreloadAsync(assetsAssociatedInstances, function(_assetId: string, status: Enum.AssetFetchStatus)
if status == Enum.AssetFetchStatus.Success then
currentAmountOfPreloadedAssets += 1
warn("loaded asset #" .. currentAmountOfPreloadedAssets, "out of", totalAmountOfAssetsAssociatedInstances, "total")
else
totalAmountOfAssetsAssociatedInstances -= 1
end
end)