game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(char)
char:WaitForChild("Humanoid").BreakJointsOnDeath = false
char.Humanoid.Died:Connect(function()
char.Archivable = true
local clone = char:Clone()
clone.Name = "Corpse"
clone.Parent = game:GetService("Workspace")
for _, v in pairs(clone:GetDescendants()) do
if v:IsA("BasePart") then
v.Anchored = false
end
if v:IsA("Motor6D") then
local Att0, Att1 = Instance.new("Attachment"), Instance.new("Attachment")
Att0.CFrame = v.C0
Att1.CFrame = v.C1
Att0.Parent = v.Part0
Att1.Parent = v.Part1
local BSC = Instance.new("BallSocketConstraint")
BSC.Attachment0 = Att0
BSC.Attachment1 = Att1
BSC.Parent = v.Part0
v.Enabled = false
end
end
clone.HumanoidRootPart.CanCollide = false
clone.Humanoid:ChangeState(Enum.HumanoidStateType.Dead)
for i, v in pairs(char:GetChildren()) do
if v:IsA("MeshPart") or v:IsA("BasePart") or v:IsA("Accoutrement") then
v.Parent = nil
end
end
end)
end)
end)