My offset script doesn't work. I have been trying to use print() to find out the magnitude but no luck.
for i = 1, 5 do
local barriers = {}
local separation = 20
local p = Vector3.new(math.random(-140,-110), workspace.Platform.Position.Y - num1/2 + 0.5, math.random(22,85))
local nearest = 100
for _, barrier in pairs(barriers) do
nearest = (barrier - p).magnitude
print(nearest) --nothing appears here
end
if nearest > separation then
table.insert(barriers, p)
--build offset stuff
end

3 comments
If you need help fixing it, then it would help if you described your goal with more detail.
How would i combat this?
well, my goal is to randomly generate parts at least 20 studs away from each other, but the offset doesnt work.