You need to provide the image ID instead of the decal ID. They’re separate assets and PreloadAsync expects the former. You can convert a decal ID to its image ID with a couple methods in Studio:
Insert the decal ID into a Decal Instance and get the new ID it produces
Use a plugin like Imiji that simplifies the next method
Use LoadAsset or GetObjects to load the Decal and read its Texture property
local marketPlaceService = game:GetService("MarketplaceService")
local insertService = game:GetService("InsertService")
local clientLoadFolder = game.ReplicatedStorage.ClientLoad
local gUI_Images = require(game.ReplicatedStorage.GambleUI_HeldAssets.Modules.itemFrameManager.ImageIds)
local ids = {}
for imageName, imageTable in pairs(gUI_Images) do
if imageTable["ItemID"] then
ids[imageName] = imageTable["ItemID"]
end
end
local baseDecal = Instance.new("Decal")
local function loadID(id, name)
local aI = marketPlaceService:GetProductInfo(id, Enum.InfoType.Asset)
if aI.AssetTypeId ~= Enum.AssetType.Decal.Value then
warn("Error loading id: " .. id)
return
end
local newDecal = insertService:LoadAsset(id):FindFirstChildWhichIsA("Decal")
newDecal.Parent = clientLoadFolder
newDecal.Name = name
end
for name, id in pairs(ids) do
loadID(id, name)
end
and on the client i used:
local clientLoad = game.ReplicatedStorage.ClientLoad
local cProvider = game:GetService("ContentProvider")
-- eventaully add a check when all images are loaded
task.wait(2)
local idTable = {}
for _, decal : Decal in ipairs(clientLoad:GetChildren()) do
local trueId = string.split(decal.Texture, "http://www.roblox.com/asset/?id=")[2]
itemFrameManagerModule.OverwriteImage(decal.Name, trueId)
table.insert(idTable, "rbxassetid://" .. trueId)
decal:Destroy()
end
cProvider:PreloadAsync(idTable, function(ID, Status)
print("PreloadAsync() resolved asset ID:", ID)
print("PreloadAsync() final AssetFetchStatus:", Status, "\n")
end)