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

I don't know how to find all the children from all the models in the game. Any help ?

local RenderParts = {}
for i,v in pairs(game.Workspace:GetChildren()) do
	if v.ClassName == "Part" then
		table.insert(RenderParts, v)
	elseif v.ClassName == "Model" then
		table.insert(RenderParts, v.ClassName("Model"):GetChildren())
	end
end

PlayerScripts.Render:6: attempt to call a string value

1 comment

0

You would have to do another for loop for that model to insert each child. so it would be else if ..... for , in pairs(model:GetChildren()) do insert end

1 answer

✓ Accepted answer

Use :GetDescendants() instead of :GetChildren() to get every instance in the Workspace, instead of just the direct children.

Edit: Using GetDescendants, you can remove the part where it checks for the Model as it is not needed.

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