I have created a script which works out the cost of an Avatar. However, it does not take into account items from bundles and animation packages. How do I achieve this?
This is the script:
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
function GetAvatarWorth(id)
local info = Players:GetCharacterAppearanceInfoAsync(id)
local items = info.assets
local Avatar_Worth = 0
for x,v in pairs(items) do
local ProductInfo = MarketplaceService:GetProductInfo(v.id,Enum.InfoType.Asset)
if ProductInfo.IsForSale then
Avatar_Worth += ProductInfo.PriceInRobux
end
end
return Avatar_Worth
end
local player = Players.LocalPlayer
local label = script.Parent.Rank
label.Text = GetAvatarWorth(player.UserId)
Perhaps what you’re looking for is a HumanoidDescription? This also returns animation and body parts ids.
To fetch a player’s humanoid description use the Players:GetHumanoidDescriptionFromUserId(userId) function, assuming this isn’t for temporary in-game avatars but their website avatar.
Sorry for the late reply, but how would I add this to the script so that the price of any bundles or animation packages the player is wearing is added to “Avatar_Worth”.
For example, the player is wearing the Korblox leg but I want to get the price of the Korblox Deathspeaker bundle and add it to “Avatar_Worth”