Model doesn't load any children when they are in folders

I have a model that is used in a generation system. It usually works completely fine and loads in well, but as soon as i added a new folder inside and put all of the walls of the room inside it, now it cant detect any of the children in the model using :GetChildren(), why is this? its super confusing and im wondering if this is a bug, or im stupid.

Code Snippet:

local genroom = pickroom()

	if not genroom then
		return
	end
	
	print(genroom) -- testing
	
	for i,v in pairs(genroom:GetChildren()) do
		warn(v.Name, genroom) -- never warns anything
	end

prints nothing except the room name - print(genroom), and an infinite yield error from code below simply defining a folder which i know 100% exits: Infinite yield possible on 'Intersection:WaitForChild("DoorAreas")
image

Extra Note: This happens no matter which room i do it on.

Any help would be great.

3 Likes

While the room is like this, I can’t set it’s parent either: The Parent property of Intersection is locked, current parent: NULL, new parent GeneratedRooms

4 Likes

I may be slightly ignorant to your issue, however, folders are not exempt from being “Children”.

“Children” are instances, which folders are also of that BaseClass. Therefore :GetChildren() will grab the folders, and not the children inside.

You have two solutions:

  1. Get the children, then loop through the children and do some logic with any children within the folders via :GetChildren() again.

  2. Use the :GetDescendents() method which will get ALL children, including the children of the children. (If that makes sense)

3 Likes

Yeah, ik, thats what im doing later on:
image

What i was doing earlier was just a test to see if ANYTHING loaded, which nothing does.

2 Likes

print(genroom) prints only the name? like a string?

2 Likes

What do you mean by nothing loading???

2 Likes

yeah it just prints the name of it, works the same as .Name (well idk if its a string but it does print the name of it)

1 Like

can you double check if the pickroom() function does not return a .name?

1 Like
print(genroom)
	
	if genroom:IsA("Model") then
		print("model")
	end

Result:

20:29:14.043  Intersection  -  Server - GenerationModule:146
  20:29:14.043  model  -  Server - GenerationModule:149

It’s a model.

2 Likes

okay, what i want you to do, test it in the game, and see the generator model, try to see if there are stuff missing on it. if it is, you might want to anchor everything in the model.

1 Like

The parts and folders inside just aren’t able to be accessed, like they dont exist.

1 Like

is the script a local script or a server script

1 Like

It is a server script.

word limit

1 Like

weird, can you try to test it and check on the explorer if there are stuff missing in the model?

1 Like

I can’t really check because i cant set it’s parent lol.

1 Like

what i mean is play the game in studio, go to the explorer and see if the model has parts missing, you can switch to server view if the model is in serverstorage or something like that

1 Like

well, as for the non-cloned room in ReplicatedStorage, its fine.
image

but yeah, i can’t check the cloned room.

2 Likes

weird, this isnt a problem with your script, its more of the set-up.if the cloned room isnt really in workspace then it means its being deleted by something, either its somehow falling out of the map (consider anchoring everything in the model just to see) or see if a script is interfering with it

1 Like

Yeah just tested and everything was already anchored, stuff like this really ticks me off, how does this even happen for such a weird change too.

1 Like

you might want to re check your pickroom() function, can you send it here? (cause your pick room function is the only suspect other than roblox engine)

1 Like