|
| 07 Sep 2012 02:22 PM |
Would this work in Local or server side script?
function find_assets(dir) assets = {} local ws = workspace:children() for i = 1, #ws do if ws[i].ClassName == "Decal" or ws[i].ClassName == "Texture" then assets[#assets + 1] = ws[i].Texture else find_assets(ws[i]) end end for i=1, #assets do Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..assets[i]) end end
function run() print("Finding assets..") find_assets(game.Workspace) find_assets(game.StarterGui) find_assets(game.Lighting) print("Assets loaded.") end
run()
|
|
|
| Report Abuse |
|
|
|
| 07 Sep 2012 02:23 PM |
Neither. Take a look at the composition of your find_assets function. ;) |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2012 02:28 PM |
How about now ;D
function find_assets(dir) assets = {} local ws = dir:children() for i = 1, #ws do if ws[i].ClassName == "Decal" or ws[i].ClassName == "Texture" then assets[#assets + 1] = ws[i].Texture else find_assets(ws[i]) end end for i=1, #assets do Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..assets[i]) end end
function run() print("Finding assets..") find_assets(game.Workspace) find_assets(game.StarterGui) find_assets(game.Lighting) print("Assets loaded.") end
run()
|
|
|
| Report Abuse |
|
|
|
| 07 Sep 2012 02:30 PM |
local ws = workspace:children()
should be
local ws = Workspace:GetChildren()
Ignore fire fox, he's not helping you at all, I'm pretty sure you knew your error was in the function. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2012 02:31 PM |
Just use
:GetChildren()
Instead of
Children() |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2012 02:32 PM |
Destroshun this isn't your first time trying to help people with misleading information. Nor is this your first encounter with Firefox.
So, just get out unless you have something helpful, or a thread you actually need help in. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2012 02:33 PM |
| I did help you, it has to be :GetChildren(), but what ever, do what you want, ignore my help. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2012 02:34 PM |
:children()
and
:GetChildren()
have the exact same results. It doesnt matter one bit. Come on, try it out and see im right ;) |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2012 02:36 PM |
Again Destro, you show that you've no clue what you're talking about. Here's the fixed script:
assets = {}
function find_assets(dir) local ws = dir:children() for i = 1, #ws do if ws[i].ClassName == "Decal" or ws[i].ClassName == "Texture" then assets[#assets + 1] = ws[i].Texture else find_assets(ws[i]) end end end
function run() print("Finding assets..") find_assets(game.Workspace) find_assets(game.StarterGui) find_assets(game.Lighting) for i=1, #assets do Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..assets[i]) end print("Assets loaded.") end
run() |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2012 02:38 PM |
| Ahh, forget it, I fail, AFF will be my replacement for SH. Bye! |
|
|
| Report Abuse |
|
|