Today, when helping out a friend of mine with programming, we ran into a problem. The following code works as you would expect.
local Player = game:GetService("Players")
local Character = Player.Character or Player.CharacterAdded:Wait()
print(Character) -- Character
print(Character:GetChildren()) -- {} --> blank table
Character
works fine. However, what I found interesting about this particular case, was that upon using Character:GetChildren()
, a blank table is returned. The console shows as follows:
This is quite puzzling to me, as I personally have never encountered this problem before. The script is located in StarterPlayerScripts, and there are no other plugins or scripts that could be interfering.
We found an annoying fix. Using WaitForChild
to get any instance you would expect to find in the default character, such as the Humanoid, and then using GetChildren
then produced what you would normally expect- an array with all of the children inside.
Character:WaitForChild("Humanoid")
print(Character:GetChildren()) -- {"Humanoid", "HumanoidRootPart", ...) etc
I was wondering if anyone has encountered this problem before? Or if it is potentially a result of the new studio update(s)?