I have a game where players can place buildings on a grid and then their building placements are saved in a 2D array.
An example of a two by two grid would look like
Grid = {
{{visual = script.Parent["1,1"], buildingId = "Road"}, {visual = script.Parent["1,2"], buildingId = "Road"}},
{{visual = script.Parent["2,1"], buildingId = "Road"}, {visual = script.Parent["2,2"], buildingId = "House"}
}
This all works well but I need a way to go through one of these 2D arrays and check that all of the roads are connected to each other. I’ve tried checking that there are only two endpoints but that makes it so that players can only have one straight road which isn’t ideal.