Someone told me what was wrong with my script, and I want to know how to combat it. My goal is to make blocks randomly appear at least 20 studs away from each other, but the offset doesn't work.
for i = 1, 5 do
local barriers = {} --empty table
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 --the table is empty, so the loop doesn't run
nearest = (barrier - p).magnitude
print(nearest) --nothing appears here
end
if nearest > separation then
table.insert(barriers, p)
--build offset stuff
end
