Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help fixing a offset script. [?]

Asked by 9 years ago

I have this offset thing BlueTaslem helped me make, but the offset doesn't work

for i = 1, 2 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 = math.huge
for _, barrier in pairs(barriers) do
nearest = math.min(nearest, (barrier - p).magnitude)
if nearest > separation then
    table.insert(barriers, p)
print(nearest)--this always returns infinity for some reason
local brick = game.ServerStorage.Disco:Clone()
local block = brick:FindFirstChild("Barrier")
brick.Parent = game.Workspace:FindFirstChild("PartModel")
block.Size = Vector3.new(1,num1,num2)
block.BrickColor = BrickColor.Random()
    block.CFrame = CFrame.new(p)
end
end
end

Answer this question