For some reason, two more items have been included in the table after the loop ran a few more times, and I’m still not sure about the root cause of this.
▼ {
[1] = 0.5,
[2] = 4.031128883361816,
[3] = 4.031128883361816,
[4] = 5.678908348083496,
[5] = 8.015609741210938,
[6] = 8.015609741210938,
[7] = 8.958236694335938,
[8] = 8.958236694335938,
[9] = 11.32475185394287,
[10] = 12.01041221618652,
[11] = 12.01041221618652,
[12] = 12.65898895263672,
[13] = 12.65898895263672,
[14] = 14.43087005615234,
[15] = 14.43087005615234,
[16] = 16.97792625427246
} - Server - Expand:25
18:46:51.982 0.5 - Server - Expand:27
18:46:52.996 ▼ {
[1] = 0.5,
[2] = 4.031128883361816,
[3] = 4.031128883361816,
[4] = 5.678908348083496,
[5] = 8.015609741210938,
[6] = 8.015609741210938,
[7] = 8.958236694335938,
[8] = 8.958236694335938,
[9] = 8.958236694335938,
[10] = 11.32475185394287,
[11] = 12.01041221618652,
[12] = 12.01041221618652,
[13] = 12.65898895263672,
[14] = 12.65898895263672,
[15] = 14.43087005615234,
[16] = 14.43087005615234,
[17] = 16.97792625427246,
[18] = 16.97792625427246
} - Server - Expand:25
18:46:52.996 0.5 - Server - Expand:27
18:46:54.015 ▼ {
[1] = 0.5,
[2] = 4.031128883361816,
[3] = 4.031128883361816,
[4] = 5.678908348083496,
[5] = 8.015609741210938,
[6] = 8.015609741210938,
[7] = 8.958236694335938,
[8] = 8.958236694335938,
[9] = 8.958236694335938,
[10] = 11.32475185394287,
[11] = 12.01041221618652,
[12] = 12.01041221618652,
[13] = 12.65898895263672,
[14] = 12.65898895263672,
[15] = 14.43087005615234,
[16] = 14.43087005615234,
[17] = 14.43087005615234,
[18] = 16.97792625427246
} - Server - Expand:25
18:46:54.016 0.5 - Server - Expand:27
18:46:55.028 ▼ {
[1] = 0.5,
[2] = 4.031128883361816,
[3] = 4.031128883361816,
[4] = 5.678908348083496,
[5] = 8.015609741210938,
[6] = 8.015609741210938,
[7] = 8.958236694335938,
[8] = 8.958236694335938,
[9] = 8.958236694335938,
[10] = 11.32475185394287,
[11] = 12.01041221618652,
[12] = 12.01041221618652,
[13] = 12.65898895263672,
[14] = 12.65898895263672,
[15] = 14.43087005615234,
[16] = 14.43087005615234,
[17] = 14.43087005615234,
[18] = 16.97792625427246
} - Server - Expand:25
18:46:55.029 0.5 - Server - Expand:27
local capital = script.Parent
local conqueringRegion = Region3.new(Vector3.new(43, .5, -14), Vector3.new(20, 5, 10))
local conqueringRegionVisual = Instance.new("Part")
local LandPartTable = workspace:WaitForChild("LandPartTable"):GetChildren()
local landClosestTo = {}
while task.wait(1) do
conqueringRegionVisual.Anchored = true
conqueringRegionVisual.Parent = workspace
conqueringRegionVisual.Transparency = 0.8
conqueringRegionVisual.Size = Vector3.new(math.abs(conqueringRegion.Size.X), math.abs(conqueringRegion.Size.Y), math.abs(conqueringRegion.Size.Z))
conqueringRegionVisual.CFrame = conqueringRegion.CFrame
for _, landPart in pairs(LandPartTable) do
table.insert(landClosestTo, (landPart.Position - capital.Position).Magnitude)
end
table.sort(landClosestTo, function(a,b)
return a < b
end)
print(landClosestTo)
print(landClosestTo[1])
for i, v in pairs(landClosestTo) do
for i = 1, #landClosestTo do
table.remove(landClosestTo, i)
end
end
end