I have a simple problem. I am using :GetChildren
to return a list of children to a character.
Specifically I am looking to find accessories.
Given that char
is the variable to a character within a game.
When the line char:GetChildren()
is ran a table of instances are returned.
None of which elements are accessories.
How come? And how do I find accesories otherwise?
I have tried :GetDescendants()
This is my script and goal:
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
for _,v in pairs(char:GetChildren()) do
if v:IsA("Accessory") then
v:Destroy()
end
end
end)
end)
My Goal is to remove accessories from players upon entering the game. Does there happen to be a better way of doing this?
Even if there is a better way of doing this, how come :GetChildren()
doesn’t include all instances? It’s not just Accessories it excludes. I haven’t tested it, but I have noticed it skips out on some things. It just hasn’t become a problem until now.
I haven’t been coding for a while so I’m a little rusty and may have just overlooked something simple, but I’m unsure what else to do regarding :GetChildren()
to return ALL children.
All the children (so what it should be returning):
What it returns instead: