I can show you code from one my mods that has that function if wanted.
I'm EJ's friend, so you can trust me.
i wanna know how
There's a mod on my Scratch profile called "ClutterSprunk remake", Seamellow and Dingus use that code.
You can use that as a base, but give credit if so.
WELL WELL WELL. Tq, I've been looking for this.