The accessories stay on for a few seconds but just fall off after a few seconds, i have tried by making the rootjoint not get turned into a ball joint but allas, it still failed.
here is the code, it is server side in startercharacterscripts. it is r6 too.
local rig = script.Parent
local humanoid = rig:WaitForChild("Humanoid")
local function ragdoll()
humanoid.PlatformStand = true
humanoid.AutoRotate = false
for index,joint in pairs(rig:GetDescendants()) do
local smallboom = Instance.new("Explosion")
smallboom.BlastPressure = 500
smallboom.BlastRadius = 1
smallboom.ExplosionType = Enum.ExplosionType.NoCraters
smallboom.DestroyJointRadiusPercent = -1
smallboom.Parent = rig
smallboom.Position = rig.HumanoidRootPart.Position
smallboom.Visible = false
if joint:IsA("Motor6D") then
if joint.Name == "RootJoint" then
else
local socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
a1.Name = "RagdollAttachment0"
a2.Name = "RagdollAttachment1"
a1.Parent = joint.Part0
a2.Parent = joint.Part1
socket.Name = joint.Name
socket.Parent = joint.Parent
socket.Attachment0 = a1
socket.Attachment1 = a2
a1.CFrame = joint.C0
a2.CFrame = joint.C1
socket.LimitsEnabled = true
socket.Restitution = 0
socket.UpperAngle = 45
socket.TwistLowerAngle = -30
socket.TwistUpperAngle = 30
socket.TwistLimitsEnabled = true
joint:Destroy()
end
end
if joint:IsA("BasePartPart") then
joint.CanCollide = true
end
if joint:IsA("Accessory") then
end
end
end
humanoid.Died:Connect(ragdoll)