--[[

-- Alternate script for NPCS to have Ragdoll Death. Copy this code and put it into a script inside an NPC.

local c = script.Parent

c.Humanoid.BreakJointsOnDeath = false
c.Humanoid.Died:Connect(function()
	c.HumanoidRootPart.RotVelocity = Vector3.new(10,10,10) -- Hopefully makes it so whenever you die, you don't just stand still. Feel free to remove it lols
	for _, v in pairs(c:GetDescendants()) do
		if v:IsA("Motor6D") then
			local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
			a0.CFrame = v.C0
			a1.CFrame = v.C1
			a0.Parent = v.Part0
			a1.Parent = v.Part1
				
			local b = Instance.new("BallSocketConstraint")
			b.Attachment0 = a0
			b.Attachment1 = a1
			b.Parent = v.Part0
					
			v:Destroy()
		end
	end
	c.HumanoidRootPart.CanCollide = false
end)



]]