I am making a for loop to filter through the players character. It wasn't working. I figured out why. I put the players Children in a variable called d. #d returns 0. This is the code I use to get D:
local player = game.Players.LocalPlayer
local d
player.CharacterAdded:Connect(function()
if player.Character then
d = player.Character:GetChildren()
print(#d)
end
end)
However, if I try doing something like this:
print(d:WaitForChild("Head").Name)
It returns "Head" Why is #d not working?

2 comments
Note, the second example is if I remove the GetChildren part
try changing to :GetPlayers()