I do not know what could be causing this, since I have 3 hats equipped, but they arent destroyed.
Anyone know how to fix this?
Code:
--local c = character yadda yadda yadda etc
for i,v in pairs(c:GetDescendants()) do
if v:IsA("BasePart") and v.Parent:IsA("Accessory") then
print(v,"2")
v.Parent:Destroy()
end
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
plr.CharacterAppearanceLoaded:Wait()
for _, hat in chr:GetDescendants() do
if hat:IsA("Accessory") then
hat:Destroy()
end
end
end)
end)
You’ve got --local c = character yadda yadda yadda etc, maybe explain exactly what this line says. Does this reference the character in the workspace, in the Players service, or somewhere else?
Where is the script located, and is it a local or server script?
Do you want all player’s hats to be destroyed when they join, or do you just want hats that are located in their backpacks destroyed?