So I have a doughnut machine, and the doughnuts are grouped for easier management. When the donuts are deleted, the group that holds them does not, which could probably lag servers after a few runs, how can I fix this without deleting donut groups that have donuts in them?
EDIT: Forgot to mention I want to check each D1 group for children (as shown in gif) and not just the main group so I can delete groups without children that are in the main group.

1 comment
also sorry for no code examples, I didn't really know how to start.