I’m working on a renderer that uses Region3 to determine the radius & then load parts required.
Now, it works correctly up until the final part - When attempting to remove from the table, it fails to do so and in turn when it comes to rendering it again - it simply does not.
Does anyone have any suggestions?
VisualUtil.Render = function(Exterior, World)
local BasePosition = Exterior.PrimaryPart.Position
local Min = BasePosition - Vector3.new(750, 750, 750)
local Max = BasePosition + Vector3.new(750, 750, 750)
local Region = Region3.new(Min, Max)
local PartsInRegion = workspace:FindPartsInRegion3(Region, nil, math.huge)
for __,Part in pairs (PartsInRegion) do
if Part:IsDescendantOf(Exterior.PrimaryPart.Parent.Parent) or Part:IsDescendantOf(Player.Character) or Part:IsDescendantOf(Camera) then else
if PartInRender[Part] then
else
PartInRender[Part] = Part:Clone()
PartInRender[Part].Parent = World
end
end
end
for __,Part in pairs (PartInRender) do
if (Part.Position - Exterior.PrimaryPart.Position).Magnitude > 1000 then
Part:Destroy()
PartInRender[Part] = nil
end
end
end