Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

GetDescendants not getting all descendants?

I have a script that needs to find all of the descendants of the workspace using the workspace:GetDescendants() command. For some reason, when I use a server script, the command only gives me some of the workspace's descendants. HOWEVER, when I tried it with a local script, workspace:GetDescendants() returned all of the descendants. Why is this? Is get descendants broken when used on the server side?

1 comment

0

Are you immediately getting workspace's descendants? Chances are, the server script is running before all of the descendants are loaded. When it runs in the LocalScript, the player has to load in, and then the script will run which gives the descendants time to load.

1 answer

The server script may be running before the character loads in, and the character is part of the workspace (and takes up a lot of descendants)

Check if the LocalScript runs after the character loads in. I've tested this for myself, and they both return the same thing.

2 comments

0

Well, what I mean is that I have a many parts in some folders parented to workspace, and only some of them are being detected by getdescendants. This isn’t about the character

0

Try changing where they are or getting them out of the work sapce and try merging them together

This discussion is preserved as it was. New answers, comments, and votes are closed.