I want to check if an asset exists and what’s its type if it does exist.
Here’s my code where I check is asset available:
local success, errormessage = pcall(game:GetService("MarketplaceService").GetProductInfo, game:GetService("MarketplaceService"), message[2])
if success then
end
I have no clue how to check is an asset a music. I have seen few pages including this page and this page and I still don’t know what’s the solution for the topic.
Please help me. Thanks.
local success, dict = pcall(game:GetService("MarketplaceService").GetProductInfo, game:GetService("MarketplaceService"), message[2])
if success then
if dict.AssetTypeId == Enum.AssetType.Audio then
-- it's an audio, run code
end
end
local success, dict = pcall(game:GetService("MarketplaceService").GetProductInfo, game:GetService("MarketplaceService"), message[2])
if success then
if dict.AssetTypeId == 3 then
-- it's an audio, run code
end
end