Is there a way that you could view someone’s pants from their inventory? I’m trying to make a ranking center to rank them if they have more than or equal to 3 pants from a group. Any help?
You can use PlayerOwnsAsset
-- This script might not work, I have not tested it completely
local MarketplaceService = game:GetService("MarketplaceService")
local function countPantsAsync(player)
local pants = {"01234567", "9999999", "314159265"};
local total = 0;
local counted = 0;
local finished = Instance.new("BindableEvent")
for _, pantsId in pairs(pants) do
spawn(function()
local success, hasAsset = pcall(MarketplaceService.PlayerOwnsAsset, MarketplaceService, player, pantsId)
counted+=1;
if hasAsset then total+=1 end
if counted==#pants then
finished:Fire(total)
end
end)
end
return finished.Event:Wait()
end
The reason the code is so long is because it is instead of waiting for one asset check to finish, it runs them all at once, and returns after they have all finished.
This is an awkward idea and I feel like MarketplaceServer:PlayerOwnsAsset is eventually going to throttle.
Make a Dummy, and create a Shirt instance parented to the dummy. Then put the pants id to their pants id. You can get their pants by just doing
character.Pants.PantsTemplate
Once you have created the dummy, use a viewport frame to view it.
It probably will as I believe the maximum amount of requests the server can output is 600 a minute.
The OP only wants to check how many they have.
AvatarEditorService:GetInventory{Enum.AssetType.Pants}
Its not currently usable (without messing with Studio’s configuration settings), but hey. If you get those config settings it does work.
https://inventory.roblox.com/v2/users/2024883525/inventory/12?sortOrder=Asc&limit=100
use this (also try it out with rprxy.xyz)
Yeah, you can’t edit this on the ‘real server’. Also, this will be made publicly available when it’s finished.
This won’t work if their inventory is private.
Duh…? It will send a response code (which you can use to tell the player: ‘yo bro make ur inv public pretty please’)
code 4
Yeah, but many devs (including me) will just leave your game if you ask this, since we have our inventories private to keep our assets private so our games don’t get leaked.
Since this is a ranking system type thing, the player would have no other choice. if the player isnt gonna open up their inventory then they just wont get their rank.
Also, just to inform you this only gets the first 100. And because of request limits you may only request 50,000 pants per minute. I know it’s a high number but your taking a risk if a player has more than that.
Yeah I know, It does say limit=100
. Thanks though!
never mind i already found a solution, thanks to everyone that tried to help.