for _, asset in pairs(game.Players:GetCharacterAppearanceInfoAsync(player.UserId).assets) do
if asset.assetType.name == "Hat" then
local Info = game:GetService("MarketplaceService"):GetProductInfo(asset.AssetId) -- This says "Argument 1 missing or nil"
local Template = game.ServerStorage.AvatarSystem.ItemEquippedTemplate:Clone()
Template.Parent = player.PlayerGui.MainGui.Avatar.Frame.Wearing
Template.Id.Value = Info.AssetId
Template.Icon.Image = 'rbxthumb://type=Asset&w=150&h=150&id='..tostring(Info.AssetId)
Template.Roblox.Visible = true
end
end
On the line that’s erring, try switching asset.AssetId to just asset.Id.
Edit:
Oh, that function actually takes two parameters, i.e. MarketplaceService:GetProductInfo(asset.Id, Enum.InfoType.Asset).
Nope… it still didn’t work. hmm
Are there an error in your output? If there is, what does it say?
The same thing as before “Argument 1 missing or nil”
Oh, the issue here is that table keys are case-sensitive, so asset.Id = nil while asset.id = 6803410579. The following code works for me:
local players = game:GetService("Players")
local player = players.LocalPlayer
for _, asset in pairs(players:GetCharacterAppearanceInfoAsync(player.UserId).assets) do
if asset.assetType.name == "Hat" then
print(asset)
local info = game:GetService("MarketplaceService"):GetProductInfo(asset.id, Enum.InfoType.Asset)
print(info)
end
end
and outputs:
13:36:46.224 ▼ {
["assetType"] = ▶ {...},
["id"] = 6803410579,
["name"] = "Gucci Wide Brim Felt Hat"
} - Client - Testing:6
13:36:47.882 ▼ {
["AssetId"] = 6803410579,
["AssetTypeId"] = 8,
["ContentRatingTypeId"] = 0,
["Created"] = "2021-05-11T23:24:06.213Z",
["Creator"] = ▶ {...},
["Description"] = "This wide brim hat is completed by an oversize satin bow. Item created by RookVanguard. This is a collectable item",
["IconImageAssetId"] = 0,
["IsForSale"] = false,
["IsLimited"] = true,
["IsLimitedUnique"] = false,
["IsNew"] = false,
["IsPublicDomain"] = false,
["MinimumMembershipLevel"] = 0,
["Name"] = "Gucci Wide Brim Felt Hat",
["ProductId"] = 1174064293,
["ProductType"] = "User Product",
["Sales"] = 0,
["TargetId"] = 6803410579,
["Updated"] = "2021-05-17T16:09:11.833Z"
} - Client - Testing:8
I have a question - after you retrieve the product info from MarketplaceService, do you use anything from the data beside AssetId? If you don’t, the call to the service is unnecessary as you already have acess to the id through asset.id. Hope this helps! 
I have it so when the player joins in the in-game avatar editor it puts little bubbles for what items they’re wearing along with the icons of them and when you click them it removes the items. Ya, I think it is not necessary
for _, asset in pairs(game.Players:GetCharacterAppearanceInfoAsync(player.UserId).assets) do
if asset.assetType.name == "Hat" then
local Info = game:GetService("MarketplaceService"):GetProductInfo(asset.id, Enum.InfoType.Asset)
local Template = game.ServerStorage.AvatarSystem.ItemEquippedTemplate:Clone()
Template.Parent = player.PlayerGui.MainGui.Avatar.Frame.Wearing
Template.Id.Value = Info.AssetId
Template.Icon.Image = 'rbxthumb://type=Asset&w=150&h=150&id='..tostring(Info.AssetId)
Template.Roblox.Visible = true
end
end