Greetings,
as this is more of a theoretical question, I will not be including a .rblx file unless somebody requests it.
Here is the current setup,
i got a map made up of (5,1,5) size parts, about 1800 per map, and i got a bomb that explodes and changes the collision group of the parts in a 11 stud radius and their transparency, and to do that i use a for loop that iterates through a folder containing the current map, which is a model.
for i,v in pairs(workspace.CurrentMap:FindFirstChildWhichIsA("Model"):GetChildren()) do
if v:IsA("BasePart") then
local Start = Pos
local End = v.Position
local Mag = (End - Start).Magnitude
if Mag <= 11 then
if v.Name ~= "Spawn" then
v.Transparency = .75
v.CollisionGroupId = 1
end
end
end
end
it works perfectly, but i am worried that this might be a bad approach? what do you guys think?
just to check something i put in a print in the loop and my game froze for a bit every time the loop ran and printed 1800+ times so i am now worried this is poor design
Ideally i’d like to avoid having to search the whole map and just scan in the radius around the position of the bomb, however i don’t know if that’s even possible let alone how to do it.
Any advise would be greatly appreciated, thank you for your time