Hey guys - quick question. I’m trying to validate whether a given asset ID is valid or not, but I’m not sure which Service or function is the best for doing so. I could try preloading it with ContentProvider, but that seems weird to me. I could also try inserting it with InsertService, but I’m not sure it’s worth all the hassle of making a Model with it inside. I also want to validate that the asset ID refers to an image, and not a model or any other kind of asset.
Don’t get me wrong either - if ContentProvider or InsertService are really the best options, I’m open to suggestions on using them too.
local Marketplace = game:GetService("MarketplaceService")
--method call replacement: a:b(...) == a.b(a, ...)
local valid = pcall(Marketplace.GetProductInfo, Marketplace, assetId)
--if valid then or if pcall(Marketplace.GetProductInfo, Marketplace, assetId) then
Thanks for your input, but please don’t either assume nor insult my intelligence and/or experience. I’ve been scripting for many years, I’ve just never come across this particular problem and was looking for a pointer in the correct direction. I know exactly what a pcall and functions do. These are great suggestions - I will try them out soon and come back with results.
if EnterPressed then
local newCursor = tonumber(searchBar.Text)
local succ = pcall(function()
if succ then