This doesn’t seem to affect my computer at all, but im more conserned about smaller devices, as this non stop loop uses the :FindFirstChild()
and :GetChildren()
function. Will this lag out smaller devices?
If so, how can i optimize this? I need CheckGrid function to stay in a loop due to how my system will work.
function CheckGrid()
local GridParts = BuildingGrid:GetChildren() -- Get the 15x30 grid full of 1 stud BaseParts
for i, Grid in ipairs(GridParts) do
if Grid:FindFirstChild("BridgePart") and Grid.BridgePart.Value == nil then -- Check if there is an empty value
Grid.BridgePart:Destroy() -- Delete the instance
end
end
end
RS.RenderStepped:Connect(function() -- run through a non stop loop
CheckGrid()
end)