Help with grid drawing

hello, i am following this video: Programming Mazes and i have ran into a problem.

–image

the problem that i am facing is that i only want one block to be white
—image of what it should be
Screenshot 2021-12-30 151230

this is the line of code that handles the drawing

function Maze:Draw()
	print(self.newMapArray)
	for x = 0, self.width do
		if x < self.width then
			for y = 0, self.height do
				if y < self.height  then
					if self.newMapArray[y * self.width + x] and self.enum.CELL_VISTED then
						local part = Instance.new("Part")
						part.Parent = workspace
						part.Size = Vector3.new(0.3, 0.3, 0.3)
						part.Position = Vector3.new(x, 0, y)
						part.BrickColor = BrickColor.White()
						part.Anchored =true
					else
						local part = Instance.new("Part")
						part.Parent = workspace
						part.Size = Vector3.new(0.3, 0.3, 0.3)
						part.Position = Vector3.new(x, 0, y)
						part.BrickColor = BrickColor.Red()
						part.Anchored =true
					end
				end
			end
		end
	end
end

how could i solve this?

yoo i have figured it out pog :slight_smile:

function Maze:Draw()
	print(self.newMapArray)
	for x = 0, self.width do
		if x < self.width then
			for y = 0, self.height do
				if y < self.height  then
					if self.newMapArray[y * self.width + x] and self.enum.CELL_VISTED then
						if self.newMapArray[y * self.width + x][0] == 16 then
							local part = Instance.new("Part")
							part.Parent = workspace
							part.Size = Vector3.new(0.3, 0.3, 0.3)
							part.Position = Vector3.new(x, 0, y)
							part.BrickColor = BrickColor.White()
							part.Anchored =true
						else
							local part = Instance.new("Part")
							part.Parent = workspace
							part.Size = Vector3.new(0.3, 0.3, 0.3)
							part.Position = Vector3.new(x, 0, y)
							part.BrickColor = BrickColor.Red()
							part.Anchored =true
						end
					else
						local part = Instance.new("Part")
						part.Parent = workspace
						part.Size = Vector3.new(0.3, 0.3, 0.3)
						part.Position = Vector3.new(x, 0, y)
						part.BrickColor = BrickColor.Red()
						part.Anchored =true
					end
				end
			end
		end
	end
end

leaving this here just incase anyone is doing the same thing has i am

1 Like