Not Getting Asset Type

The Value is the Id and it’s a shirt but I get “error” in the output which means Roblox doesn’t think it’s a shirt, pants, or face even tho it is a shirt

local Event = game.ReplicatedStorage.RemoteEvents.AvatarSystem.Wear

Event.OnServerEvent:Connect(function(player,Value)

	local Info = game:GetService("MarketplaceService"):GetProductInfo(Value)

	if Info.AssetTypeId == (Enum.AssetType.Shirt) then

		local model = game:GetService("InsertService"):LoadAsset(Value) 
		player.Character.Shirt:Destroy()
		model.Parent = workspace
		model.Shirt.Parent = player.Character
		model:Destroy()
		
		print("Asset = shirt")

	elseif Info.AssetTypeId == (Enum.AssetType.Pants) then

		local model = game:GetService("InsertService"):LoadAsset(Value) 
		player.Character.Pants:Destroy()
		model.Parent = workspace
		model.Pants.Parent = player.Character
		model:Destroy()
		
		print("Asset = pants")
		
	elseif Info.AssetTypeId == (Enum.AssetType.Face) then

		-- WIP

	else
		
		print("Error")
		
	end
end)

That’s honestly weird - it should return as true if the Enum checked for .AssetTypeId of the product, but it seems like the feature doesn’t work properly, else could be wrong.

Instead of using Enum.AssetType, use the respective numbers that represent the asset:

  • 11 for shirt,
  • 12 for pants,
  • and 18 for face.

The Info.AssetTypeId returns the number, correspondingly as shown above. Full list can be found here.

1 Like