Why is my open level function crashing the engine?

how would i loop over?