You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
For testing purposes I’m trying to print out the list from a test folder. My actually intention is to get the Humanoid of all the NPCs from a folder. I have looked though other forums and videos but just didn’t work. If there is any other forums that I may have missed please let me know.
What is the issue? Include screenshots / videos if possible!
Script:
local npc = script.Parent
local list = workspace.TestFolder:GetChildren()
--local tab = {"1", "2", "3"}
for i,v in pairs(list) do
--if v:FindFirstChild("Humanoid") then
print("Got list")
--end
end
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried making an actually table and it would return the table but not the list, I’m not sure if this is correct but GetChildren() is sopposed to return the children of the specified instance, but in this case I’m not sure why its not returning anything.
What is located in workspace.TestFolder? There should be children parented under that folder, otherwise it won’t return anything. Another possibility is that the children aren’t loaded yet when this script is running.
Then it hasn’t really printed anything. That’s just it stating what command bar code you’re executing. In order to print something, use print(). Try putting print(list) at the end of the command bar code and executing it.
It worked. But I hope you don’t mind but I’m trying to make an NPC that chases the other npcs in the test folder, so I have the AI script done but the part where the NPC does damage to the other NPCs in the test folder doesn’t work, that was where the problem where I wasn’t able to get the Humanoid from the for loop. When I put the loop plus the wait() you said into the AI script then it doesn’t work.