I want to make a system where you can check the Robux value of a player’s avatar. I want to calculate the price of the shirts, pants, t-shirts, and all other accessories. How can I do this?
I’ve found HumanoidDescription but I don’t know if I can do anything about it.
I’d suggest collecting all the items on the avatar, then using a proxy getting info of one item, detect the price and plus it with another price if that makes sense.
Edit: Here’s an example script. Chat someone’s username, you get their avatar worth printed.
This is probably a bit inaccurate but it should work decent enough.
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
function GetAvatarWorth(id)
local info = Players:GetCharacterAppearanceInfoAsync(id) -- Get the info
local items = info.assets -- Get player items
local Avatar_Worth = 0 -- Avatar worth in Robux
for x,v in pairs(items) do -- For every key/value pair in items do...
local ProductInfo = MarketplaceService:GetProductInfo(v.id,Enum.InfoType.Asset) -- Get product info
if ProductInfo.IsForSale then -- If it's for sale...
Avatar_Worth += ProductInfo.PriceInRobux -- Add price in robux
end
end
return Avatar_Worth -- Return avatar worth
end
Players.PlayerAdded:Connect(function(player)
print(player.Name .. "'s avatar is worth " .. GetAvatarWorth(player.UserId) .. " Robux")
player.Chatted:Connect(function(msg)
local PN = Players:GetUserIdFromNameAsync(msg)
if PN then
print(GetAvatarWorth(PN))
end
end)
end)