roblox studio get player avatar price
xxxxxxxxxx
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")
end)