Let say I have a Folder named ‘Bricks’ and it has 5,000models that all have a random number of parts in (around 10 atleast in each). And i keep calling :GetChildren In a loop. Would that lag the game or not?
Example
local RunService = game:GetService("RunService")
local Bricks = workspace.Bricks
RunService.RenderStepped:Connect(function()
for Count, Object in pairs(Bricks:GetChildren) do
--blah blah blah
end
end)
Depending on the number of objects and what you’re using the loop for, that would absolutely start having a performance impact since you’re doing that every frame
I don’t know when you will ever need 5000 models, but nonetheless your game is gonna lag anyway since it has to load the models, espacially if you use RunService and looping it all the time
Yes. In theory if you parent all 5000 models into a parent model, it is 1 movement instead of 5000. - That is how models are calculated as far as I am aware. This is also why it is way less laggy, when you try to move 1 model consisting of 5000 parts, instead of the 5000 parts directly.