Custom Clothing Inserter for R6 not working but works on R15?

I have an old (Lets say 4 years old) clothing inserter, it still works on R15 models, but when I try to make a new game for inserting on R6 clothing, it doesn’t work. I tried to fix it, but I end up breaking the whole script. Anyone could help me out?

-- This is the Main Clothing Changer, Inserting Hats don't stack either.
ChangeAvatarEvent.OnServerEvent:Connect(function(player, id)
		local character = player.Character
		local humanoid = character:FindFirstChild("Humanoid")

		if not humanoid or humanoid.Health == 0 then return end

		local products = {}

		local success,err = pcall(function() 
			local productsInfo = MPS:GetProductInfo(id)

			table.insert(products,{
				Id = id,
				AssetTypeId = productsInfo.AssetTypeId
			})
		end)

		if not success then
			local items = AS:GetBundleDetailsAsync(id).Items
			for a = 1,#items,1 do
				local productInfo = MPS:GetProductInfo(items[a].Id)
				table.insert(products, {
					Id = items[a].Id,
					AssetTypeId = productInfo.AssetTypeId
				})
			end
		end

		local humanoidDescription = humanoid:GetAppliedDescription()
		for i = 1,#products,1 do
			local assetTypeId = products[i].AssetTypeId

			if assetTypeId == Enum.AssetType.Hat.Value then
				humanoidDescription.HatAccessory = humanoidDescription.HatAccessory..","..products[i].Id
			end

			humanoidDescription = changeBodyParts(humanoidDescription,assetTypeId,products[i].Id)
			humanoidDescription = changeClothes(humanoidDescription,assetTypeId,products[i].Id)
			humanoidDescription = changeAccessoies(humanoidDescription,assetTypeId,products[i].Id)
		end
		humanoid:ApplyDescription(humanoidDescription)
end)

-- These are the Functions supported
function changeAccessoies(humanoidDescription, assetTypeId, id)
		print(humanoidDescription.HatAccessory..","..id)
		if assetTypeId == Enum.AssetType.BackAccessory.Value then
			humanoidDescription.BackAccessory = humanoidDescription.BackAccessory..","..id

		elseif assetTypeId == Enum.AssetType.FaceAccessory.Value then
			humanoidDescription.FaceAccessory = humanoidDescription.FaceAccessory..","..id

		elseif assetTypeId == Enum.AssetType.FrontAccessory.Value then
			humanoidDescription.FrontAccessory = humanoidDescription.FrontAccessory..","..id

		elseif assetTypeId == Enum.AssetType.HairAccessory.Value then
			humanoidDescription.HairAccessory = humanoidDescription.HairAccessory..","..id

		elseif assetTypeId == Enum.AssetType.Hat.Value then
			humanoidDescription.HatAccessory = humanoidDescription.HatAccessory..","..id

		elseif assetTypeId == Enum.AssetType.NeckAccessory.Value then
			humanoidDescription.NeckAccessory = humanoidDescription.NeckAccessory..","..id

		elseif assetTypeId == Enum.AssetType.ShoulderAccessory.Value then
			humanoidDescription.ShouldersAccessory = humanoidDescription.ShouldersAccessory..","..id

		elseif assetTypeId == Enum.AssetType.WaistAccessory.Value then
			humanoidDescription.WaistAccessory = humanoidDescription.WaistAccessory..","..id
		end
		return humanoidDescription
end

function changeClothes(humanoidDescription,assetTypeId,id)

		if assetTypeId == Enum.AssetType.Shirt.Value then
			humanoidDescription.Shirt = id

		elseif assetTypeId == Enum.AssetType.Pants.Value then
			humanoidDescription.Pants = id

		elseif assetTypeId == Enum.AssetType.TShirt.Value then
			humanoidDescription.GraphicTShirt = id
		end		
		return humanoidDescription
end

function changeBodyParts(humanoidDescription,assetTypeId,id)
		if assetTypeId == Enum.AssetType.Face.Value then
			humanoidDescription.Face = id

		elseif assetTypeId == Enum.AssetType.Head.Value then
			humanoidDescription.Head = id

		elseif assetTypeId == Enum.AssetType.LeftArm.Value then
			humanoidDescription.LeftArm = id

		elseif assetTypeId == Enum.AssetType.LeftLeg.Value then
			humanoidDescription.LeftLeg = id

		elseif assetTypeId == Enum.AssetType.RightArm.Value then
			humanoidDescription.RightArm = id

		elseif assetTypeId == Enum.AssetType.RightLeg.Value then
			humanoidDescription.RightLeg = id

		elseif assetTypeId == Enum.AssetType.Torso.Value then
			humanoidDescription.Torso = id
		end
		return humanoidDescription
end
2 Likes

Hey, I tried your code and everything seems fine? I’m probably missing something here.

Could you provide some more detail into what the problem is?

I’m trying to use this whole code block for R6 clothing, because my Game focuses on R6. Yes, it still works on R15.

Is there something that I have to turn on within the game settings because I feel like there are things I forgot to switch, I did have https turned on for remote events.

I just found the problem, I just had forgot to type some words :sob: this is so embarrassing, turns out the problem lies on the Client Script itself. Thanks for trying to help though!! Appreciate it so much.

2 Likes