I followed a tutorial online that was similar to this but with event listeners. However, it doesn’t work, even though no error shows up.
-- [[ Services ]] --
local Players = game:GetService("Players")
local playerHumanoid = character:WaitForChild("Humanoid")
playerHumanoid.BreakJointsOnDeath = false
for _, v in pairs(character:GetDescendants()) do
if v:IsA("Motor6D") then
local attachment0,attachment1 = Instance.new("Attachment"), Instance.new("Attachment")
attachment0.CFrame = v.C0
attachment1.CFrame = v.C1
attachment0.Parent = v.Part0
attachment1.Parent = v.Part1
local ballConstraint = Instance.new("BallSocketConstraint")
ballConstraint.Attatchment0 = attachment0
ballConstraint.Attatchment1 = attachment1
ballConstraint.Parent = v.Part0
character.HumanoidRootPart.CanCollide = false
OP, I am not too sure of how to approach making that kind of system as I am struggling to make a ragdoll myself. However, once you make a successful ragdoll function, you could place it anywhere else and it won’t have to be placed inside of an event when the player dies.
As for bringing the player back to a normal state, maybe you can mess around with player states and force them to stand up again, destroy the ball constraints and re-enable the Motor6D. That’s what I’ve heard around the forum.