Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Generate A Random Decal?

Asked by 6 years ago

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

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

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)
0
Ty Hexo_Gen -5 — 6y
Ad

Answer this question