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

Generate A Random Decal?

I am trying to generate a random decal by generating a random asset id and putting it into a decal. However, the image is only a decal 10% of the time due to the id usually being something like a mesh or a model. And there's no way to check if the asset id generated is a decal from my knowledge...

1 answer

Try this:

local mas = game:GetService("MarketplaceService")

function generate()
	local num = math.random(1,99999999)
	local data = mas:GetProductInfo(num)
	local array = {
		Number = num;
		IsADecal = (data.AssetTypeId) == 13;
	}
	
	return array
end

--Example

local a = generate()
print(a.Number,a.IsADecal)

1 comment

0

Ty

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