Help with R6 Toggleable Ragdoll system

A while ago I came across a module made by badacc for a toggleable r15 ragdoll system and I decided to modify it to make it work for R6. I succeeded but there is a small bug that kills they player occasionally when they are Unragdolled and I cant figure out why. If anyone can tell me why or just point me in the right direction it would be much appreciated.

EDIT: sorry for bad post formatting this is my first post and I have no idea how to format it right

Here’s the module with instructions:

Created my own toggleable ragdoll from scratch