If it freezes it’s a logic error somewhere in your loop events where they never end so it becomes an infinite loop.
To debug where the error is I usually write it a bit at a time and make sure it works for the simpler stuff before adding more to it. That way it’s easier to track when you introduce the error.
Another idea is to try to use the debugger to step through the events. Although I haven’t really used it and I’m not sure how detailed it’s able to step through your events.
You could also use “repeat” or “for” instead of “while” for your loops. With those a logic error would just not work instead of freezing. Also tweaking your logic to use those loop conditions instead may help fix the logic anyways.
Once you get it not to freeze you could log values to the console or editbox as your events run. And that could be a tool to see what is happening and maybe help you spot where to look for the error.
Just reading the events and running them in your mind sometimes works too. But breaking things down to simpler steps helps more.
Anyways, those are some strategies I use.
I used to be better at debugging others code but lack the time and patience lately.
What you’re running into with using all those while loops is there are many more places for the code to fail so it’s too tall an order to debug from a screenshot. A minimal example to download is better for other users to fiddle with if they get the urge to give debugging a go.
There could be some action or condition that’s not working as you expected. For that I often find it useful to do small tests with them to better understand what they are doing.