workspace:GetDescendants() doesn't get character

  • I am trying to make it get all of the Characters that have a Humanoid. But when I do it doesn’t get the player character. When I check the printed table of the descendants listed I didn’t see my name(PurpNinjalol) on it.
-- Server Sided
local assets = workspace:GetDescendants()
for i = 1,#assets do
	if assets[i]:IsA("Model") then
		local Humanoid = assets[i]:FindFirstChildWhichIsA("Humanoid")
		if Humanoid then
			print("Humanoid found in:",assets[i])
		end	
	end
end
-- Printed Values:
  15:04:24.742  Humanoid found in: R15  -  Server - FollowPlayer:6
  15:04:24.744  Humanoid found in: Rocko  -  Server - FollowPlayer:6
-- It doesn't print out "Humanoid found in: PurpNinjalol"

Gonna comeback in a few minutes or so…

Would it be possible for you to loop through Players and use Players.Player.Character (Player.Character) to get the Humanoids?

Sure lemme try it am gonna modify the script :smile:

it could be that your character has not loaded yet. Try waiting a few seconds before running the script

1 Like

i have tried that by doing task.wait(10) but it doesn’t still print it

are you sure you placed the wait above the second line like this?

-- Server Sided
task.wait(10)
local assets = workspace:GetDescendants()
for i = 1,#assets do
	if assets[i]:IsA("Model") then
		local Humanoid = assets[i]:FindFirstChildWhichIsA("Humanoid")
		if Humanoid then
			print("Humanoid found in:",assets[i])
		end	
	end
end```
1 Like

Done that before didn’t work also how does the 30char limit mean?

Oh wait I think I found the solution thank you @Brambes230605 for the help I put in under the assets… My bad :grin:

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.