When the player clicks a button, it will generate a math.random() number. If the math.random number is a valid place and the creation date is not the same as the updated date, it will teleport all players to that place. If the random number is not a place, or it has the creation date set as the same as the updated date, it will repeat the math.random number, then it checks again. But, sometimes, this error comes up:
MarketplaceService:getProductInfo() failed because HTTP 400 (Bad Request)
This is the piece of code:
local games
local name
repeat games = math.random(1000,99999999)
until market:GetProductInfo(games).AssetTypeId == 9 and market:GetProductInfo(games).Created:gsub("T.*", "") ~= market:GetProductInfo(games).Updated:gsub("T.*", "")
print("Valid game found!)
end
Why is this error happening and how can I stop it? Much appreciated.

1 comment
Make sure to wrap them in a pcalls when requesting somthing from the Roblox website