Is Applying a humanoid description the best way to customize a character with normal shirts and pants? Because, i loop through all sorts of stats including body colors, and clothing that the play may or may not be wearing, and the script works fine other than when i try to apply the description. Does anyone have any thoughts on this? I get nothing but an error that says:
They shouldn’t be repeating, This is the chunk of code, its only a part of it:
local HumDesc = hum:GetAppliedDescription()
for Stats,Statname in pairs(CharacterInfo:GetChildren()) do
print(Statname.Value, "here")
--Skin Tone Identifier--
if Statname.Name == "Skin Tone" then
HumDesc.HeadColor = Statname.Value
HumDesc.LeftArmColor = Statname.Value
HumDesc.LeftLegColor = Statname.Value
HumDesc.RightArmColor = Statname.Value
HumDesc.RightLegColor = Statname.Value
HumDesc.TorsoColor = Statname.Value
end
for i,Item in pairs(Apparel_Fold:GetDescendants()) do
--Clothing [Upper, Lower, Full_Set]--
if Statname.Name == "Upper" or Statname.Name =="Lower" then
if Item.Name == Statname.Value then
--Upper Body if not default--
if Statname.Name == "Upper" and Statname.Value ~= "Default" then
if Inv_Apparel:WaitForChild(Statname.Value):WaitForChild("Equippable_Type").Value == "Full_Set" then -- is full set
HumDesc.Shirt = Item.Value
HumDesc.Pants = Apparel_Fold.Lower:WaitForChild(Statname.Value).Value
hum:ApplyDescription(HumDesc)
else -- is not full set
HumDesc.Shirt = Item.Value
hum:ApplyDescription(HumDesc)
end
--Lower Body if not default--
elseif Statname.Name == "Lower" and Statname.Value ~= "Default" then
local UpperVal = CharacterInfo:WaitForChild("Upper").Value --Value of the upper body full set id
if Inv_Apparel:WaitForChild(UpperVal).Equippable_Type.Value == "Full_Set" then -- is full set
HumDesc.Pants = Apparel_Fold.Lower:WaitForChild(UpperVal).Value
hum:ApplyDescription(HumDesc)
else -- is not full set
HumDesc.Pants = Item.Value
hum:ApplyDescription(HumDesc)
end
--Upper/Lower Default
elseif Statname.Value == "Default"then
if Statname.Name == "Upper" then -- is upper body
HumDesc.Shirt = Item.Value
hum:ApplyDescription(HumDesc)
elseif Statname.Name == "Lower" then -- is lower body
local UpperVal = CharacterInfo:WaitForChild("Upper").Value
if Inv_Apparel:WaitForChild(UpperVal).Equippable_Type.Value == "Full_Set" then --is full set
HumDesc.Pants = Apparel_Fold.Lower:WaitForChild(UpperVal).Value
hum:ApplyDescription(HumDesc)
else -- is not full set
HumDesc.Pants = Item.Value
hum:ApplyDescription(HumDesc)
end
end
end
end
so there are several paramaters, 1 Upper is not default, 2. Lower is not default, 3. one or the other is defualt. If its not default it checks for a few things, if the upper which has two possibilities, either upper or fullset, if its a full set than it makes the Upper torso the right id, and then tracks the lower torsos id that corrosponds with the first one, and makes that the id. That goes on afew times. Do you see something i don’t?
p.s. sorry for the messy script, it copied strangely into the box.
You could try printing out Item.Value to find the duplicate ID.
for i,Item in pairs(Apparel_Fold:GetDescendants()) do
print(Item.Value) -- Are there duplicates in this list?
--Clothing [Upper, Lower, Full_Set]--
As @anon81993163 mentions, this error message is talking about Asset ID values. Somewhere there is duplicated Asset ID or an Asset ID being being used more than once.
You could also
print(HumDesc.Pants)
after each line where "HumDesc.Pants = " is assigned.
Yes this line should only appear once at the bottom of the loop, for cleaner reading and more paintable code that is less prone to typos and copy/paste errors.
A common pattern is to gather all the values, settings, and details that you want to set / assign / apply, and then issue the statement or command to set / assign / apply them.