ContentProvider:PreloadAsync( ) do not work

I’m trying to load these Decals, but it won’t.

local ContentProvider = game:GetService("ContentProvider")

local Decal = Instance.new("Decal")
Decal.Texture = "rbxassetid://9590263764"

local Decal2 = Instance.new("Decal")
Decal2.Texture = "rbxassetid://9590262329"

local Assets = {Decal,Decal2}

ContentProvider:PreloadAsync(Assets)

print("a")

print(“a”) do not work

It didn’t work

local ContentProvider = game:GetService("ContentProvider")

local Decal = Instance.new("Decal")
Decal.Texture = "rbxassetid://9590263764"

local Decal2 = Instance.new("Decal")
Decal2.Texture = "rbxassetid://9590262329"

local Assets = {Decal,Decal2}

for i,v in pairs(Assets)do
	ContentProvider:PreloadAsync(v)
	print('Preloaded asset '..v)
end

I’m using a script in ServerScriptService
image

1 Like

Are there any errors in the output? Would help if there are, I have barely used contentprovider:preloadasync, but I can still help.

Alright, my bad. Here is the fix, I do not think contentprovider works on a server script, try a local script in startergui instead. And it should work with the code you’ve, no changes. You preload something on client, you cannot use the preload function on server I believe, if there is something you want everyone to preload after an event, you could probably use FireAllClients() to do so.

2 Likes

Also, I was wrong with the for i,v in pairs fix. I’ve checked ContentProvider and it requires an array(table) as an argument so yeah it was just the script issue, it should be a local script not a server script.

Working now, thxx

image

1 Like