Converted this script as a request, it's not been fully tested as I don't have the playerbase to do so, so please report back if something doesn't work. Credits to Grandelf for the original script.
Requires the latest commit:
Tested with 6 characters, fixed and working. If you have any more issues, please report.