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

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

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

2 comments

0

It is possible but you'll have to write one.

0

what are the functions that can be used to do this

1 answer

✓ Accepted answer

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

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