So ive made this script where it duplicates 6x6 stud parts onto a 300x36 stud area. Every time a new part is duplicated, Var increases by 1. When Var reaches 300, the area stops generating. Then a function is activated so that each duplicant has its size increases randomly (in the y direction). The problem is, the output reads: bad argument #1 to 'pairs' (table expected, got nil). If you don't understand, please test the script for yourself:
Pos = game.Workspace.Model.Part.Position
x = 0
y = 0
z = 0
Var = 0
Var1 = 0
function Random()
for i,v in pairs(Parts) do
v.Size = Vector3.new(6,math.random(1,5),6)
end
end
repeat
wait(0.01)
x = x + 6
Var = Var + 1
Var1 = Var1 + 1
local NewPart = game.Workspace.Model.Part:Clone()
NewPart.Anchored = true
NewPart.Parent = game.Workspace.Model
NewPart.Position = Pos + Vector3.new(x,y,z)
if Var1==50 then
Var1 = 0
x = 0
z = z + 6
end
until Var==300 do
Random()
Parts = game.Workspace.Model:GetChildren()
end
