|
| 18 Sep 2015 12:02 PM |
How would I return a table of every single Asset ID in a game, instead of typing out the ID of every Asset that I use?
|
|
|
| Report Abuse |
|
|
|
| 18 Sep 2015 12:03 PM |
Be more specific.
I was gonna make a dubstep joke but I guess ill just drop it. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2015 12:04 PM |
Use loops.
local assets = {} for i,v in pairs(game.Lighting:GetChildren()) do if v:isA("Sound") then table.insert(assets, #assets+1, v.SoundId) elseif v:IsA("Animation") then bla bla bla
elseif.. bla bla bla end end |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2015 12:04 PM |
| Oh and at the end:"return assets" |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2015 12:05 PM |
I'm trying to create a loading script, and to do so, I have to type out the Asset ID of every single Asset I'd like to Preload.
How do I create a table of every single Asset ID used in the game, then preload it? |
|
|
| Report Abuse |
|
|
Xsitsu
|
  |
| Joined: 28 Jul 2009 |
| Total Posts: 2921 |
|
|
| 18 Sep 2015 12:06 PM |
Traverse every single instance in your game with a recursive function and add the asset ids to some table.
Here's something to get you started:
local assets = {} function Search(obj) for i, v in pairs(obj) do --// Add AssetID to assets table Search(v) end end
Search(game) |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2015 12:07 PM |
| Thanks Insane, I posted too slow. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2015 12:07 PM |
If you want a preload script use that:
local preloader = game:GetService("ContentProvider") --TheCode i sent you before
for i,v in pairs(assets) do preloader:Preload(v) repeat wait() until preloader.RequestQueueSize <= 0 end
--In a local script obv. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2015 12:09 PM |
Never heard of all this preloading jazz. What's the point of it?
I was gonna make a dubstep joke but I guess ill just drop it. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2015 12:09 PM |
| I'll make a Free Model for preloading stuff. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2015 12:21 PM |
| There is a plugin that gives you a table of all Ids in the game |
|
|
| Report Abuse |
|
|