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

How can I make a script which knows if an asset is invalid or deleted?

I was trying to make a music player and thought of making a script that identifies an asset if it is valid, invalid, or not a sound ID, but it made me think "how can I find the results directly from the sound instance?" I researched and find no results. For now I haven't made a code. Does someone know an easy way to make a script which identifies asset id's presence and validity?

1 answer

✓ Accepted answer

You could use MarketPlaceService:GetProductInfo() to find if the sound exists in the website library or not.

local mas = game:GetService('MarketplaceService')
local soundId = 0

local asset = mas:GetProductInfo(soundId)

if asset.Name ~= nil then
       print('exists')
else
       print("doesn't exist")
end

1 comment

0

It works. Thanks!

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