So basically, I’ve been scripting a character generator. When characters generate you can click on them and you can try on the outfit or u can buy the accessories in it.
Now I have an issue with the “buy accessory” part.
If a humanoiddescription section has 2 IDs it will bug my script. When there’s 1 id it works fine
How can I fix this?

local rep = game:GetService("ReplicatedStorage")
local p = game:GetService("Players").LocalPlayer
local of = p.OutfitFocus
local but = script.AccessoryButton
rep.OpenCharacterGui.OnClientEvent:Connect(function()
p.PlayerGui.MainGUI.Try.Visible = true
local humDesc = of.Value:FindFirstChild("Humanoid").HumanoidDescription
local a = humDesc.BackAccessory
local b = humDesc.FaceAccessory
local c = humDesc.FrontAccessory
local d = humDesc.HairAccessory
local e = humDesc.HatAccessory
local f = humDesc.NeckAccessory
local g = humDesc.ShouldersAccessory
local h = humDesc.WaistAccessory
if a ~= "" then
local newBut = but:Clone()
newBut.Parent = script.Parent
newBut.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=".. a .."&width=420&height=420&format=png"
newBut.Name = a
print(a)
end
if b ~= "" then
local newBut = but:Clone()
newBut.Parent = script.Parent
newBut.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=".. b .."&width=420&height=420&format=png"
newBut.Name = b
print(b)
end
if c ~= "" then
local newBut = but:Clone()
newBut.Parent = script.Parent
newBut.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=".. c .."&width=420&height=420&format=png"
newBut.Name = c
print(c)
end
if d ~= "" then
local newBut = but:Clone()
newBut.Parent = script.Parent
newBut.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=".. d .."&width=420&height=420&format=png"
newBut.Name = d
print(d)
end
if e ~= "" then
local newBut = but:Clone()
newBut.Parent = script.Parent
newBut.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=".. e .."&width=420&height=420&format=png"
newBut.Name = e
print(e)
end
if f ~= "" then
local newBut = but:Clone()
newBut.Parent = script.Parent
newBut.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=".. f .."&width=420&height=420&format=png"
newBut.Name = f
print(f)
end
if g ~= "" then
local newBut = but:Clone()
newBut.Parent = script.Parent
newBut.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=".. g .."&width=420&height=420&format=png"
newBut.Name = g
print(g)
end
if h ~= "" then
local newBut = but:Clone()
newBut.Parent = script.Parent
newBut.Image = "https://www.roblox.com/asset-thumbnail/image?assetId=".. h .."&width=420&height=420&format=png"
newBut.Name = h
print(h)
end
end)