Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why won't my asset images load?

--Local Script
local cp = game:GetService("ContentProvider")
local toLoad = {}
for i,v in pairs(game.ReplicatedStorage.ItemList:GetChildren()) do
	for _,item in pairs(v:GetChildren()) do
		for index,value in pairs(item:GetChildren()) do
			if value.ImageId.Value ~= 0 then
				table.insert(toLoad, "http://www.roblox.com/asset/?id=" .. value.ImageId.Value)
			end
		end
	end
end
for i,v in next,toLoad do
	cp:Preload(v)
end

--Later in the script...
itemFrameClone.ImageLabel.ImageButton.Image = "http://www.roblox.com/asset/?id=" .. item.ImageId.Value

I tried pre-loading images, but it made no difference, unless I am doing it wrong. There is always an error that says "failed to load texture format" and the image never shows on the ImageButton.

Help appreciated, thanks!

1 answer

When you want to turn an image or decal for a game, you have to change the asset IRL.To get the asset URL, you need to take the ID and subtract one (or two/three if someone uploaded something at exactly the same time as you). *Hint: you can use this method to copy any shirts, pants, and t-shirts. And I don't know if your script is right or wrong.

Example

https://www.roblox.com/catalog/156476828/Donation

would be come

https://www.roblox.com/catalog/156476827/Donation

Or

https://www.roblox.com/library/386230624/Roblox-decals

would become

https://www.roblox.com/library/386230623/Roblox-decals

This discussion is preserved as it was. New answers, comments, and votes are closed.