So basically I've been trying to make a button that loads a random decal. Problem is, decals share the same IDs as models, places, etc...
I've tried doing a script, which keeps randomly choosing asset IDs until it finds a decal but it's not working for some reason.
local ID = math.random(1, 73737627) local MarketplaceService = game:GetService("MarketplaceService") local productInfo = MarketplaceService:GetProductInfo(ID, Enum.InfoType.Product) if productInfo.AssetTypeId == 7 then print("Success!")
Could somebody either help me with it or show me an alternate way? Thanks.
You can create a table of the decals you want and select a random one from there:
local decals = script.Parent.Decals:GetChildren() local ID = decals[math.random(1, #decals)]
ID
will be a completely random decal that has been chosen from the table. In order to make it work, every ID would have to be an IntValue
.