I was trying to make a simple script that removes the player’s accessories when they join the game, but I ran into a problem when I run through the children of the character the accessories actually do not appear and I haven’t had this problem before, Any help is appreciated.
if currenttable.RemoveAccOnArmor == true then
print(currenttable.RemoveAccOnArmor)
wait(2)
print("Waited")
for i,v in pairs(character:GetChildren()) do
print(v.Name, ";", v.ClassName, ";", v.Parent.Name)
if v:IsA("Accessory") then
print("Accessory Found")
end
end
end
Are you using the .CharacterAdded event? Because the character parts are still not loaded when that event fires. Use .CharacterAppearanceLoaded event instead.
Every accessory has a handle that is is the model of the accessory, and the BasePart that many functions detect. Use :GetDescendents() instead to get every item inside the model. Then, check if it is a child of a model. If yes, then either destroy it or change the parent of the accessory to nil.
@BenMactavsin Is on the right track with using .CharacterAppearanceLoaded.
If you are attempting to find all the accessories while not fully loaded some of them can be left.
So you will want to check for if they have loaded.
Your script checks out, so just make sure you are waiting until the character has loaded.