Preloading Assets doesn't work?

I won’t paste the exact code because I’m trying to pre-load 334 assets and I don’t think I have enough space for 334 strings. Pretty much, I have a Movie Theater game, with movies made up of flashing images. Unfortunately, the images flash white between frames (to load I’m assuming) so I added this localscript:

local moviestoload = {--[[334 images and a video]]}

game:GetService("ContentProvider"):PreloadAsync(moviestoload)

Unfortunately, this hasn’t stopped the flashing of images at all. Am I doing it wrong? How can I fix this? Thanks!

I encountered a similar issue my first time using PreloadAsync(). Basically, PreloadAsync() only takes Instances as parameters (not strings). So, you’ll have to create an instance for each image and video that you want to load and append all the instances into the table that gets passed into :PreloadAsync().

That said, 334 is a relatively large number of assets to be preloading. I’d recommend cutting down a little to optimize on load time.

2 Likes

How can I create an instance? Should I put it into an ImageLabel or a Decal?

Either would work, I think. But, in my experience, I’ve used Decals. Something like this should work:

local ContentProvider = game:GetService("ContentProvider")

local instanceIDTable = { --[[ Put all Decal IDs here --]] }
local instanceTable = {}

for _, id in pairs(instanceIDTable) do
      local instance = Instance.new("Decal")
      instance.Texture = id
      table.insert(instanceTable, instance)     
end

ContentProvider:PreloadAsync(instanceTable)
4 Likes

I’ll try this out, thanks for the help!

I tried it, and at first it didn’t work. I ended up putting all of the decals on an invisible part in the workspace, and the flashing is gone! Thank you so much!

You might want to try using ImageLabels and see if that works better. That might avoid the issue of adding decals unnecessarily into the workspace. Glad to help though!

1 Like

In studio, it works great, however when I join the game from roblox it still has a slight flash between images. It is very short now, but is there a way to get rid of it?

Where are you running your loading script from? You can make a loading screen, if you’d like and load players in only after all the assets are preloaded.

1 Like

The script is in a module that I load into all of my games, and the script is moved to StarterGui. Like I said, the problem doesn’t happen in studio, just in roblox.

The problem doesn’t occur on studio because studio retains loaded assets. If you restart studio, the same problem you experience from the game would likely occur. Again, I’d encourage you to look into making a loading screen.