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 » Scripters
Home Search
 

Re: Content Preload Help

Previous Thread :: Next Thread 
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
10 Sep 2017 03:39 PM
Is there a way to preload assets without having to list them? I've got too many texures and meshes in workspace and decals in gui's to be going through everything to list them in one script for preloading.
Report Abuse
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
10 Sep 2017 04:35 PM
bump
Report Abuse
s3vvy is not online. s3vvy
Joined: 24 Feb 2011
Total Posts: 983
10 Sep 2017 04:54 PM
*inserts very short phrase about recursive function that the OP will have to research for a couple hours in order to understand what i said*


Subscribe for scripting tutorials and more videos! www.youtube.com/c/SPiNClan
Report Abuse
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
11 Sep 2017 05:46 PM
bump
Report Abuse
ChaoticRequiem is not online. ChaoticRequiem
Joined: 09 Dec 2011
Total Posts: 678
11 Sep 2017 05:47 PM
ContentProvider:PreloadAsync()
Report Abuse
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
11 Sep 2017 06:56 PM
Basically the same thing since I'll have to list all the meshes in the game and same with gui objects. But thanks.
Report Abuse
WatermelonMan4676 is not online. WatermelonMan4676
Joined: 20 Jan 2014
Total Posts: 5516
11 Sep 2017 06:59 PM
even if you dont preload anything, can't you just yield until contentloadqueue or whatever is 0? preloading would be a dumb thing to do, especially if a user is on mobile, using data and isn't even required to preload all of the assets right away.
Report Abuse
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
11 Sep 2017 07:14 PM
That wont work with guis since any gui object not currently visible wont be loaded when you yield requestqueuesize to be 0. only whats visible will be loaded so if i have a block that shows a gui when touched it wouldnt have been loaded. I need a way to load everything when the player joins so nothing is missing when something needs to be shown.
Report Abuse
WatermelonMan4676 is not online. WatermelonMan4676
Joined: 20 Jan 2014
Total Posts: 5516
11 Sep 2017 07:15 PM
then do what s3vvy said
Report Abuse
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
11 Sep 2017 07:19 PM
Just said that wont really work because I still have to list everything so it'll be the same as listing all the asset id's. I'm wondering if there is a way to load everything without having to list stuff because I have too many textures, meshes, and gui objects with decals. It'll take couple hours to get everything and make a list to Preload. If anyone knows a way to do this then be sure to let me know. If not then Ill have no choice but to list everything for preloading.
Report Abuse
WatermelonMan4676 is not online. WatermelonMan4676
Joined: 20 Jan 2014
Total Posts: 5516
11 Sep 2017 07:20 PM
that wont be the same as listing all the asset ids at all, lol.
Report Abuse
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
11 Sep 2017 07:30 PM
Kinda is since you have to list all the objects with the texture/decals you want to preload.
Report Abuse
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
11 Sep 2017 08:45 PM
Bump
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
11 Sep 2017 09:09 PM
How the hell are you going to preload something if you don't have a reference to what you want to preload?


Report Abuse
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
11 Sep 2017 09:18 PM
You clearly don't understand what I'm asking.
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
11 Sep 2017 09:19 PM
I clearly don't, and I currently would be typing a solution to your problem if you would have elaborated.


Report Abuse
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
11 Sep 2017 10:09 PM
Said it twice or three times. I'm not trying to list everything in my game to preload. I just want to know if theres a way to preload every asset in the game or at least most without having to list them and use preload or preloadasync. Don't see how I can make it any more clearer.
Report Abuse
Fangous is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
11 Sep 2017 10:25 PM
Like that one guy said, use recursive functions. Here's what I use to preload images on the client. You should be able to edit it to use for your situation



local ContentProvider = game:GetService("ContentProvider")
local assets = {}
function SearchForAssets(scope)
for _, i in pairs (scope:GetChildren()) do
if i:IsA('ImageLabel') then
table.insert(assets, i.Image)
end
if i:IsA('ImageButton') then
table.insert(assets, i.Image)
end
if #i:GetChildren() > 0 then
SearchForAssets(i)
end
end
end
SearchForAssets(script.Parent)
for _, i in pairs (assets) do
ContentProvider:Preload(i)
end
repeat wait(1/10) until ContentProvider.RequestQueueSize == 0
print("Assets Loaded!")
Report Abuse
ReaperEVO is online. ReaperEVO
Joined: 24 Nov 2016
Total Posts: 54
11 Sep 2017 10:59 PM
Good script i suppose but I also have imagelabels inside of other imagelabels so this won't do. Thanks for trying tho. I'll just have to list the assets then to my needs.
Report Abuse
Fangous is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
11 Sep 2017 11:46 PM
itll still work if you change some things a bit. its not going to work perfectly for your situation since the script was made for my stuff
Report Abuse
s3vvy is not online. s3vvy
Joined: 24 Feb 2011
Total Posts: 983
12 Sep 2017 07:35 PM
I can see where you're having trouble with.

You don't exactly know how Lua terminology and processes work, and that's okay.

But when multiple people offer you the same solution, you should probably stop arguing with them, and maybe think for a second, "I may not know as much Lua as they do."

Trust me, I used to be like you, a little anarchist.

Proficient Lua code is BASED off of "lists", believe it or not.

You complimented the script that he provided you, even though it used "lists" anyways.

There are only two functions you have available to you: PreloadAsync() and Preload()

PreloadAsync() requires a "list", pauses the script, preloads every instance in that list and then resumes whatever is after. Preload() needs a single argument which is a content ID, aka "asset id link" to describe it, and does not pause to script. Instead, it adds the ID to a queue, and everything in that queue is loaded in order of chronological addition. Even though Preload() can only add one item to load to that queue every time the function is ran, you will have to run it multiple times to run multiple items.

Whether you like it or not, you are going to have to use "lists" if you want to load more than 1 object.

Now, "lists" as you call them, aren't always manually created. Sometimes they are created by functions as well. In his code, he creates a list and adds data to it.

"local assets = {}"

The data isn't manually added one by one, but is developed by a "recursive function", as other people mentioned before.

You said that you didn't want to "list" every instance in the game, yet you said the following right after:

"I just want to know if theres a way to preload every asset in the game or at least most without having to list them"

Now that can confuse a lot of people, but I understand what you're saying.

Next time, don't think that everything you know is correct and that others are wrong. You may have some slight errors in terminology which can guide your forum post to an argument.

idk why i wasted time explaining this.. something about you ticked me off


Subscribe for scripting tutorials and more videos! www.youtube.com/c/SPiNClan
Report Abuse
rihlsul is not online. rihlsul
Joined: 09 Dec 2015
Total Posts: 13
11 Oct 2017 02:13 PM
Apologies for the Necropost, but this is one of the threads that comes up when searching to learn about Preloading Assets.

Not sure if it was true when this thread was discussed, but the wiki points out that with ContentProvider:PreloadAsync():

--When the function is called, the engine will go through all of the instances in the passed in array (and all of the descendants of the passed in instances)--

So, for anyone else that comes here as I did, you could point this process at your Gui's root and let it sort it out for you.


Also, s3vvy, thank you for explanations - you don't just help the person who asked, but anyone who comes along later, so it's appreciated.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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