How do I stop it from stopping each time it errors? I'm making a random game advertisement board (for fun) but it keeps on stopping whenever it doesn't find an asset. But I want the script to ignore that and keep going. How do I achieve this?
local marketplace = game:GetService('MarketplaceService')
while wait(3) do
local min = 1
local max = 9999999999
local placeId = math.floor(math.random() * (max - min) + min)
script.Parent.Texture = "https://www.roblox.com/asset-thumbnail/image?assetId="..placeId.."&width=768&height=432&format=png"
print(placeId)
local info = marketplace:GetProductInfo(placeId)
script.Parent.Parent["Advertise!"].TextLabel.Text = info.Name
end

2 comments
Thanks, I've heard of pcall before but I didn't know it could do that.
No Problem!