Unfortunately, I did not realise that these were _not_ local entities. This seems like an oversight, so I've fixed it. I've also split the code and modernised it a little.
I'm also changing OnDestroy to OnOwnershipChanged and changing the owner properly.
Thanks for s0600204 for raising the issue
Reported by: wowgetoffyourcellphone