The accessories here are not destroying despite being parented to the character. It seems to work normally twice but breaks after three times.
if not (Player.Character:FindFirstChildWhichIsA("Accessory"):FindFirstChild("IsArmor")) then
Button.BackgroundColor3 = Color3.fromRGB(170, 0,0)
Button.UIStroke.Color = Color3.fromRGB(85, 0,0)
Button.Text = "Unequip"
SelectedItem:FindFirstChildWhichIsA("Accessory"):Clone().Parent = Player.Character
elseif Player.Character:FindFirstChildWhichIsA("Accessory"):FindFirstChild("IsArmor") then
for i, v in ipairs(Character) do
if v:IsA("Accessory") and v:FindFirstChildWhichIsA("BoolValue") then
if v.Name == SelectedItem:FindFirstChildWhichIsA("Accessory").Name then
Button.BackgroundColor3 = Color3.fromRGB(0, 170,0)
Button.UIStroke.Color = Color3.fromRGB(0, 85,0)
Button.Text = "Equip"
v:Destroy()
elseif v.Name ~= SelectedItem:FindFirstChildWhichIsA("Accessory").Name then
v:Destroy()
SelectedItem:FindFirstChildWhichIsA("Accessory"):Clone().Parent = Player.Character
UnequippedEvent:FireClient(Player)
end
end
end
end