I cant use a 2d array because every time i define the 2 array inside it resets the array and I want the array to save all the values not reset everytime the loop runs. But there isnt a way to define grid[i] without resetting it?
grid = {} for i = -radius,radius do grid[i] = {} -- Problem, resets not stores. for j = -radius,radius do local part = game.ReplicatedStorage.Grass:Clone() if math.sqrt(math.pow(i,2)+math.pow(j,2))<radius and (grid[i][j] == 0 or not grid[i][j]) then -- Pythagoras for circle algorithm print("Placing..") --CFame here(Too complicated to put in sample) grid[i][j] = 1 part.Parent = game.Workspace.Chunk else part:Destroy() grid[i][j] = 0 end end end