Get a list of all NPC's in a folder

Hi,

I am trying to do a for loop that’s loops trough a folder containing NPC so I can update them but the code below is not working and can’t figure out why all the NPC’s are in the npc folder.

for i, otherPlayer in pairs(game.Workspace.npc) do

	local otherChar = otherPlayer.Character
	
	if otherPlayer ~= plr then
		if otherChar and otherChar:FindFirstChild("HumanoidRootPart") and char:FindFirstChild("HumanoidRootPart")

for i, otherPlayer in pairs(game.Workspace.npc) do

Did you forget to function it as game.Workspace.npc:GetChildren()?

Also if you’re trying to get the NPC’s in a folder, I dont think you need otherPlayer.Character?

Thanks for the help it works, so simple I think I am getting too tied

Np, make sure to mark it as a solution so that people know about it :slightly_smiling_face: