Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way to get a random gear from the catalog?

Asked by 6 years ago

I wanted to know if there is a script to get a random gear from the catalog, is it possible?

0
It is possible but you'll have to write one. MooMooThalahlah 421 — 6y
0
what are the functions that can be used to do this AbstractDrawing 6 — 6y

1 answer

Log in to vote
0
Answered by 5 years ago

Unfortunately, I'm not aware of a direct way to do this. However, there are ways to do this by creating custom code to do so.

One way, although may be inefficient, would be to run a loop generating a random sequence of numbers and then checking to see if it's a valid asset, then checking to see if it's a valid gear item. You could even add a cooldown variable to the loop so if it runs a number of times, it can break the loop and stop any inefficiency going on there.

An example of something like this might be...


local market = game:GetService("MarketplaceService") while wait() do local id = math.random(10000,999999) --Not sure what number range I should put in here local product_info = market:GetProductInfo(id) --Check to see if it's an item or not.. if product_info then if product_info.AssetTypeId == 19 then --It's a gear item! print("Gear item found: "..product_info.Name) end end end
Ad

Answer this question