Can someone tell me why this script print's the same thing over and over again? I only have one BasePlate
, Camera
, and Terrain
but it print's them all a total of 49140
time's. Then output give's the error
14:06:57.477 - stack overflow
14:06:57.478 - Script 'Workspace.Script', Line 10 - global GatherParts
14:06:57.479 - Script 'Workspace.Script', Line 8 - global GatherParts
14:06:57.480 - Script 'Workspace.Script', Line 8 - global GatherParts
14:06:57.481 - Script 'Workspace.Script', Line 8 - global GatherParts
14:06:57.482 - Script 'Workspace.Script', Line 8 - global GatherParts
14:06:57.483 - Script 'Workspace.Script', Line 8 - global GatherParts
14:06:57.484 - Script 'Workspace.Script', Line 8 - global GatherParts
14:06:57.484 - Script 'Workspace.Script', Line 8 - global GatherParts
14:06:57.485 - Script 'Workspace.Script', Line 8 - global GatherParts
14:06:57.486 - Script 'Workspace.Script', Line 8 - global GatherParts
14:06:57.487 - Script 'Workspace.Script', Line 8 - global GatherParts
Is there anyway I can fix this script to only print once?
Code:
local count = 0 function GatherParts() for _,v in pairs(game.Workspace:GetChildren()) do if v:IsA("Model") then GatherParts() else count = count + 1 print(v.Name.." | "..count) end end end GatherParts()