:GetDescendants() Not Picking Up Folder

As the title says, I am using the :GetDescendants() function on an instance and it is giving me an array of instances as expected, but for some reason this array doesn’t include any instances that are of the type Folder and I am unsure as to why. Would anybody know a way of possibly working around this or fixing this?

local folder = your folder
		for i,v in pairs(folder:GetDescandants()) do
			v:Destroy()
end

Tried incorporating this solution with this script:

for i,v in pairs(AnalyseGroup:GetDescandants()) do
	print(v)
		if v:IsA("Folder") and v.Name == "DEUS Custom IFE" then
			DEUS_Custom_IFE_Folder = v
		end
	end
end

I was then given this error which has truly confused me…

I spelt it wrong, ops.
It’s :GetDescendants()

I should’ve spotted that as well so no worries. However, my original issue of :GetDescendants not picking up a Folder is still present. I printed the array that the function returned and the only descendant of type Folder and its subsequent descendants were not present either. Would you possibly have any idea as to why this might be?

What is the original script?
Just to see.

It should be possible to use models instead of folders as a workaround


Local desc = (path):WaitForChild(“AnalyzeFolder”):GetDescendants()

Are you sure there is no extra space at the end of the folder name? could be that reason since it’s case sensitive.

It is possible, but I want to find out why this Folder isn’t showing up in :GetDescendants() as that’s the issue as this issue could happen again in the feature with another type of instance.

That shouldn’t affect :GetDescendants() in any way since it should return an array of all descendants of an instance. It is doing that but it’s leaving out an instance of type Folder for some reason.

Turns out the folder was in the Workspace and not the model so that’s why :GetDescendants() wasn’t picking it up. :melting_face:

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