generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Local or server script

Previous Thread :: Next Thread 
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Sep 2012 02:23 PM
Neither.
Take a look at the composition of your find_assets function. ;)
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
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
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
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
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
07 Sep 2012 02:31 PM
Just use

:GetChildren()

Instead of

Children()
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
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
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
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
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
07 Sep 2012 02:38 PM
Ahh, forget it, I fail, AFF will be my replacement for SH. Bye!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image