I’m trying to generate a grid of parts from a position.


local StudWidth = 5
local StudsX = 10
local StudsZ = 10
local StudsY = 4
local Position = script.Parent.Position
for x = 1, StudsX * StudWidth, StudWidth do
for y = 1, StudsY * StudWidth, StudWidth do
for z = 1, StudsZ * StudWidth, StudWidth do
local part = Instance.new("Part",workspace)
part.Anchored = true
part.CanCollide = false
part.Shape = "Ball"
part.Material = Enum.Material.Neon
part.Size = Vector3.new(0.5,0.5,0.5)
part.Position = Position + Vector3.new(x,y,z)
end
end
end
The green part is the position from where I want to generate the grid from. I know why it’s not working, however I have no idea how to generate the grid with it being in the middle of the green part.
I’ve searched for topics covering this issue and have found none.
