Game Mode Blueprint help

I’m trying to make a wave spawner and I have a small blueprint script in my Gamemode blueprint that checks how many enemies are in the level. When I restart the engine with this script in place, the splash screen gets stuck at 75% and does not progress. This happened to me in the same project before, and the solution was to delete the game mode blueprint, and thus, my work. Clearly something is wrong with my game mode, but I’ve recreated it from scratch a few times. Is there a way to script stuff in the game mode without the engine crashing?