ForeEachLoop Crashing the game :( I don't understand why

I think it’s because you’re completely clearing TemporaryTiles after the first iteration. You could do it like this: