BodyPartFolder is the corresponding body part of the character.
local bodyPartFolder = items:FindFirstChild("R15ArtistIntent")
if index then
table.remove(characterAppearanceInfo.assets, index)
for i, part in ipairs(bodyPartFolder:GetChildren()) do
local partInCharacter = character:FindFirstChild(part.Name)
local bodyPartR15 = partInCharacter and humanoid:GetBodyPartR15(partInCharacter)
local defaultBodyPart = bodyPartR15 and defaultBodyPartsR15:FindFirstChild(part.Name)
if defaultBodyPart then
defaultBodyPart = defaultBodyPart:Clone()
humanoid:ReplaceBodyPartR15(bodyPartR15, defaultBodyPart)
end
end
else
for i, asset in ipairs(characterAppearanceInfo.assets) do
if productInfo.AssetTypeId == asset.assetType.id then
table.remove(characterAppearanceInfo.assets, i)
end
end
insertToTable(characterAppearanceInfo.assets, productInfo)
for i, part in ipairs(bodyPartFolder:GetChildren()) do
local partInCharacter = character:FindFirstChild(part.Name)
local bodyPartR15 = partInCharacter and humanoid:GetBodyPartR15(partInCharacter)
if bodyPartR15 then
humanoid:ReplaceBodyPartR15(bodyPartR15, part)
end
end
end
end
humanoid:BuildRigFromAttachments()
Debris:AddItem(items, 0)
remoteEvent:FireClient(player, characterAppearanceInfo)
end
I don’t know why it’s not working.