local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("killPlayer")

local function ConnectLimbs(char)
	local d = char:GetDescendants()
	for i=1,#d do
		local desc = d[i]
		if desc:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local part0 = desc.Part0
			local joint_name = desc.Name
			local attachment0 = desc.Parent:FindFirstChild(joint_name.."Attachment") or desc.Parent:FindFirstChild(joint_name.."RigAttachment")
			local attachment1 = part0:FindFirstChild(joint_name.."Attachment") or part0:FindFirstChild(joint_name.."RigAttachment")
			if attachment0 and attachment1 then
				socket.Attachment0, socket.Attachment1 = attachment0, attachment1
				socket.Parent = desc.Parent
				desc:Destroy()
			end	
		end
	end
end

local function doRagdoll(corpse)
	ConnectLimbs(corpse)
end

local function kill(player, hit)
	print(hit.Name.." got hit by "..player.Name.."!")
	hit.Archivable = true
	local corpse = hit:Clone()
	hit.Archivable = false
	corpse.Parent = game.Workspace
	corpse.Name = hit.Name.." -corpse"
	corpse.HumanoidRootPart.Position = hit.HumanoidRootPart.Position
	corpse.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
	corpse.Humanoid.BreakJointsOnDeath = false
	doRagdoll(corpse)
end

remoteEvent.OnServerEvent:Connect(kill)

So with my current program when the kill function is run, the player is cloned and the clone then has a ragdoll activated. The ragdoll code works with the player just not the clone, the clone does have a humanoid and all the attachments. I am also getting no errors in the server console when this code is run. So i have no idea on how to fix it.

2 comments

0

there is a much easier way for R15 ragdoll

0

So can you show me an easier way please because i've been trying to solve it on my own for 2 days now.