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

[SOLVED] How do I check for every asset in a game?

Asked by
Maxis_s 97
4 years ago
Edited 4 years ago

I'm trying to make a loading screen that checks for every asset in the game, and I mean every single instance. How would I do that?

If you can also figure out how to make: -the total amount of assets as a variable, -the current amount of loaded assets as a variable, I'd greatly appreciate that!

0
Nevermind, I might have found the solution. I'll write my answer if I solved it. Maxis_s 97 — 4y

1 answer

Log in to vote
0
Answered by
Maxis_s 97
4 years ago
Edited 4 years ago

EDIT 1: I tried something, and I got an error.

Error:

10:17:34.271 - The current identity (2) cannot Class security check (lacking permission 6)
10:17:34.272 - Stack Begin
10:17:34.272 - Script 'Players.Maxis_s.PlayerGui.loadingGUI.bg.loadingText.LocalScript', Line 6
10:17:34.272 - Stack End

Code:

local text = script.Parent
local gameAssets = game:GetDescendants()
local CP = game:GetService("ContentProvider")

for i = 1, #gameAssets do
    text.Text = "Loading Asset "..tostring(gameAssets[i]).."/"..tostring(#gameAssets)
    CP:PreloadAsync({gameAssets[i]})
end

text.Text = "Loading Complete! Joining game..."

EDIT 2: I have fixed the issue, and the script now works.

Script (for anyone who wants it):

local text = script.Parent
local gameAssets = game:GetDescendants()
local CP = game:GetService("ContentProvider")

for i = 1, #gameAssets do
    text.Text = "Loading Asset "..tostring(i).."/"..tostring(#gameAssets)
    CP:PreloadAsync({gameAssets[i]})
end

text.Text = "Loading Complete! Joining game..."

--Insert removal code here
0
Select this as the answer so other people know this question has been solved. killerbrenden 1537 — 4y
0
How do I do that? Maxis_s 97 — 4y
0
Edit your title to include [Solved] in the beginning. It should look like this: [Solved] How do I check for every asset in a game? SteelMettle1 394 — 4y
0
You can't select your own answers, but I can select yours since I'm mod. royaltoe 5144 — 4y
Ad

Answer this question