Ok, so what I mean is, like in the game Pls Donate, it gets all the players shirts and puts them onto a surface Gui, I know how to put them on a Gui, but i need the script to find the users shirts
Are you trying to make a game like Pls Donate? Let the trend die please…
No, Im not, i need the shirts for something else
I need it to make a clothing change system in my game
You’d need to use a web request to get the player’s inventory. First, enable requests the game game security settings. Then you can use an endpoint to see if the user allows you to see their inventory, then you can use another to get the items in the user’s inventory.
I can’t, I tried to remove the other things that aren’t getting the shirt but it won’t work, I only need to get the Shirts, T-Shirts, etc., not put it on a Gui
This will require HttpService because you cannot send requests to the Roblox API from a Roblox game.
Roblox Inventory API:
https://inventory.roblox.com/docs
local http = game:GetService("HttpService")
local function getUserAssetsRecursive(AssetId, userId, assets, pageNumber, lastLength)
local baseUrl = "https://www.roproxy.com/users/inventory/list-json?assetTypeId="..AssetId.."&cursor=&itemsPerPage=100&pageNumber=%s&userId=%s"
assets = assets or {}
pageNumber = pageNumber or 1
lastLength = lastLength or math.huge
local requestUrl = baseUrl:format(pageNumber, userId)
local success, result = pcall(function()
return http:GetAsync(requestUrl)
end)
if success then
if result then
local success2, result2 = pcall(function()
return http:JSONDecode(result)
end)
if success2 then
if result2 then
for _, asset in ipairs(result2.Data.Items) do
if asset.Creator.Id == userId then
table.insert(assets, asset.Item.AssetId)
end
end
if result:len() ~= lastLength then
lastLength = result:len()
pageNumber += 1
getUserAssetsRecursive(AssetId,userId, assets, pageNumber, lastLength)
end
end
end
end
end
return assets
end
local function GetUserCreatedAssets(UserId : number,Assets : table)
local createdAssets = {}
for _,enum in pairs(Assets) do
local info = getUserAssetsRecursive(enum.Value,UserId)
createdAssets[enum.Name] = info
end
return createdAssets
end
local AssetsWanted = {Enum.AssetType.Shirt,Enum.AssetType.Pants,Enum.AssetType.TShirt,Enum.AssetType.GamePass}
local data = GetUserCreatedAssets(302233980,AssetsWanted)
print(data)
--[[
{
Gamepasses = {}
Shirts = {}
TShirt = {}
Pants = {}
}
--]]
All it prints is table: 0x96ab6c9057ea9458
are you using studio?
because it works just fine for me
Yes, I am using studio i just get: table: 0x96ab6c9057ea9458
Hey I tried printing it, but all the content of the tables within shirts, pants, and t shirts are all empty.
If their inventory is hidden, you can not retrieve anything
There was a recursive function i believe.
It does use recursion, but thats not an issue. Check if you have enabled https service
It is enabled, I wish to get all of the shirts, t shirts, and pants even if the player’s inventory is private. This did work with one of the roproxy links, however, it only received one item of the player.
Not really possible, after all thats the idea of “private inventory”
In the game Pls Donate and several other games like Group Recruiting Plaza, they’re able to bypass this “private inventory” feature and receive player data without interruption.
You could try to use a game.Players.PlayerAdded:Connect()
function to grab each asset the player has, but that would be a long and tedious task.