How do you get a random asset from Roblox Catalog/Library?

  1. What do you want to achieve? Keep it simple and clear!
    I want to be able to access a random asset from Roblox’s Catalog/Library(assets such as videos and sounds)

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried using Proxy Service from these topics (Inserting EVERY hat in existence, How would I get a table of random hats? - #2 by Doqee), but I find no luck understanding how to do this. I also tried using InsertService:GetCollection() but the documentation isn’t really helpful. I am also aware of GetFreeDecals and GetFreeModels functions but these are just for some of the asset categories.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is what I have so far using ProxServ, video library was able to be printed
local ProxServ = require(game.ServerScriptService.ProxyService)
local InsertServ = game:GetService("InsertService")

local rand = Random.new()
local Proxy = ProxServ:New(
	'secret', 
	'secret'
)

local url = "https://search.roblox.com/catalog/json?CatalogContext=2&"
local params = "Category=14"
url = url..params


local VideoLibrary = ProxServ:Get(url)
local randomVid = VideoLibrary[rand:NextInteger(1,#VideoLibrary)]
print(url)
print(VideoLibrary)
print(randomVid )

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

You can load assets using the insert service by their ID with:

model = game:GetService('InsertService'):LoadAsset(ASSET_ID)

The above works for models, accessories, and anything else that might be stored as rbxm style data. You still need to have permission to insert the asset. There might also be permission issues with trying to insert in a live server to prevent exploits, but I’m not sure.

You can get information about assets using the marketplace service. I’d look through the API’s on that and see if you find what you need.

1 Like

thanks for the reply, but the problem is getting an asset id randomly.

You’ll want to make a list of assets that you can pull from randomly, since most assets won’t have permission to be inserted. That is a bit of a custom job. You’ll need someone to help you scrape assets dynamically, or populate a list by hand.

1 Like

This topic is still not yet answered, if there are experts with Roblox’s API then help would be great.