Hi, the title explains it. Also, it doesn't print the name of the hats.. It kinda just ignores it.
function getHair(plr, folder, gender) print(plr.Name.. " is a ".. gender) local hairs = serverStorage.Accessories:FindFirstChild(gender.."Hair") local hairChooser = math.random(1, #hairs:GetChildren()) print(hairChooser) local chosenHair = hairs:FindFirstChild(gender..hairChooser) chosenHair.Handle.BrickColor = BrickColor.new(colours[math.random(1, #colours)]) local clone = chosenHair:Clone() local clone2 = chosenHair:Clone() clone.Parent = folder local character = plr.CharacterAdded:Wait(2) for i,v in pairs(character:GetChildren()) do if v:IsA("Accessory") then print(v.Name.." is a hat") v:Destroy() else print(v.Name) end end clone2.Parent = character print("finished") end
Fixed it! All I had to do was use the a for loop properly.