AssetType Enum doesn't match HumanoidDescription property name

HumanoidDescriptions have a property called “ShouldersAccessory”.
The AssetType Enum has a Enum called “ShoulderAccessory”.
The first mentions shoulders.
The other mentions shoulder.
One is plural while the other is not.
I have a script that is taking a bundle from Roblox and applying each item from the bundle to a humanoid description and I noticed this slight name difference. Consistency is nice and I thought I should mention my findings.

-- By Noobot9k

local HttpService = game:GetService("HttpService")
local AssetService = game:GetService("AssetService")
local MarketplaceService = game:GetService("MarketplaceService")

function GetAssetTypeEnumFromValue(value)
	--[[
		Roblox doesn't sort the items in AssetType Enum by their "Value" property.
		For instance, "Hat" is listed as the 6th AssetType Enum, though it's "Value" is 8.
		Since MarketplaceService:GetProductInfo() returns a dictionary with AssetTypeId
		as a property, and that property references an AssetType Enum's "Value" and not its
		order in the AssetType Enum list, we'll search for it's "Value" and not just use
		Enum.AssetType:GetEnumItems()[AssetTypeId].
	--]]
	for i, AssetType in ipairs(Enum.AssetType:GetEnumItems()) do
		if AssetType.Value == value then --AssetType.Value is the "Value" I was mentioning above.
			return AssetType
		end
	end
	warn("No AssetType Enum with 'Value'", value)
end

local HumanoidDescription = script.Parent
--Script.BundleId is a stringvalue parented to this script with it's value set to 592 (https://www.roblox.com/bundles/592/Davy-Bazooka)
local bundleDetails = AssetService:GetBundleDetailsAsync(script.bundleId.Value) --592

for i, ItemToEquip in pairs(bundleDetails.Items) do
	print(i, ItemToEquip)
	for x, subdetail in pairs(ItemToEquip) do
		print("	", x, subdetail)
		
	end
	
	local AssetInfo = MarketplaceService:GetProductInfo(ItemToEquip.Id, Enum.InfoType.Asset)
	local AssetTypeName = GetAssetTypeEnumFromValue(AssetInfo.AssetTypeId).Name
	print("	", AssetTypeName, AssetInfo.AssetTypeId)
	
	if AssetTypeName == "ShoulderAccessory" then
		AssetTypeName = "ShouldersAccessory" --from shoulder to shoulders
	end
	if AssetTypeName == "Image" then
		AssetTypeName = "Face"
	end
	
	warn("	", pcall(function()
		HumanoidDescription[AssetTypeName] = ItemToEquip.Id
	end))
end

bundleDetails is a table of tables.
Each of it’s subtables looks something like this:

9 table: 0x46f8383a640e2e36
Id = 4416812356
Type = Asset
Name = “Davy Bazooka - Bazooka”
It is a BackAccessory

Or something like this.
You will see this info printed out when you run the code above.

4 Likes