Hello reader, I’m currently trying to get the players inventory in a game I’m doing to find the limited accesories the player has, and I dont really know where to start this with.
You can use the AvatarEditorService but the user has to permit access
local AvatarEditorService = game:GetService("AvatarEditorService")
local function getAssetIDs(playerID, assetType)
if not playerID then return end
local assets = AvatarEditorService:GetInventory(playerID)
if not assets then return end
local assetIDs = {}
for item, pageNo in iterPageItems(assets) do
table.insert(assetIDs, item.assetId)
end
return assets
end
Players.PlayerAdded:Connect(function(player)
AvatarEditorService:PromptAllowInventoryReadAccess()
local result = AvatarEditorService.PromptAllowInventoryReadAccessCompleted:Wait()
if result == Enum.AvatarPromptResult.Success then
local assetTypes = {
Enum.AvatarAssetType.BackAccessory,
Enum.AvatarAssetType.ShoulderAccessory,
Enum.AvatarAssetType.WaistAccessory
}
local pagesObject = AvatarEditorService:GetInventory(assetTypes)
local currentPage = pagesObject:GetCurrentPage()
for i = 1, #currentPage do
local item = currentPage[i]
print(item)
end
end
end)
Yes it would work, but not rather for what I am looking for, considering the player has to allow access. This code can help for rather customizing your avatar ingame like some avatar editors do.
Ty still.
Hello. I know I am a year late, but I figured out I will help.
The code the previous guy gave you is in fact correct, and you can sort though the limiteds or just make them display only them using MarketPlaceService and AvatarEditorService.