How would I get a random GEAR from a players ROBLOX inventory?

Hi! for this to happen you first gotta be sure their inventory is public, if it is private, then you can’t get their items in their inventory. :slight_smile:

2 Likes

some people have private inventory :tired_face:, so it might not work

As I haven’t used API’s I’m fairly new with this topic, could you put it into code in which it checks if a users inventory is visible, then if so gets a random gear ID from their inventory, I’ll do the rest

It’s fine if some invents are private, this is a pass which will have a requirement to make ur inv public while playing

Yeah, but it’ll have to wait until tomorrow cause i cant go on anymore tonight.

What if you just allowed gears for your game (what they have would immediately show up in their inventory) and take all of them save one out of their inventory?

You can’t access roblox APIs directly from roblox servers. You’d need to set up some sort of proxy server that you can send HTTP requests to. The proxy server would retrieve the data using the endpoints and return it to you. Using this method, you run into the issue of players having private inventories. What is your plan for that? I don’t have a clue what your game is about, but only using gears people own might be unfair.

If you really wanted to go this route, the easiest way of doing it is allowing gears in your game. I’m not sure if there is a way to get a gears asset Id in-game, but if there is this is how I would do it: When the player joins, remove the gears from their inventory and store the asset ID. Then you can select a random gear from the list of asset IDs and spawn it in using InsertService.