I’m trying to make a path making type of thing and last line of my script doesn’t work. Can anyone help? There is no errors yet it doesn’t work. Also negativePart is a normal part despite the name, not a negate part.
local count = 0
local pillarX = 7
local pillarZ = 7
local pastX = 0
local pastZ = 0
local direction = 0
local unionList = {}
while count < 255 do
local negatePart = game.ServerStorage.NegativePart:Clone()
negatePart.Parent = game.Workspace
negatePart.Position = Vector3.new(pillarX*8,(count*8)+12,pillarZ*8)
repeat
direction = math.random(0,3)
if direction == 0 then
if pillarX+1 < 16 then
pillarX += 1
end
end
if direction == 1 then
if pillarX-1 > -1 then
pillarX += -1
end
end
if direction == 2 then
if pillarZ+1 < 16 then
pillarZ += 1
end
end
if direction == 3 then
if pillarZ-1 > -1 then
pillarZ += -1
end
end
until 0 <= pillarX and pillarX <= 15 and 0 <= pillarZ and pillarZ <= 15 and not (pastX == pillarX and pillarZ == pastZ)
pastX = pillarX
pastZ = pillarZ
count += 1
wait()
end
for v, negatives in pairs(workspace:GetChildren()) do
if string.match(negatives.Name, "NegativePart") then
table.insert(unionList,negatives)
end
end
print(#unionList)
workspace.Union:SubtractAsync(unionList,Enum.CollisionFidelity.PreciseConvexDecomposition,Enum.RenderFidelity.Performance)```