Keeping ragdoll after death

First you need a reference to the Workspace, so add this to the top of your script, before the ConnectLimbs function.

local Workspace = game:GetService("Workspace")

Cloned instances are not parented to anything when created, so you’ll need a reference to the Workspace to move the ragdoll there.

I chose to run the ConnectLimbs function before parenting it to Workspace because it’s better to set the parent of something after you’re done setting it up for performance reasons.

humanoid.Died:Connect(function()
	local ragdoll = char:Clone()
	ConnectLimbs(ragdoll)
	char:Destroy()
	ragdoll.Parent = Workspace
end)
2 Likes