How do i make a corpse out of a players old body when they die/respawn?

So im looking for an EASY way to make the players old body remain where it died and all body parts remaining attached kind of like a ragdoll death.

Does anybody know how to do this? I rlly need this function for my horror game =)))

7 Likes

First, make or get a system to make any character a ragdoll. Then, just clone the player’s character on death and ragdoll it, removing the real character. Then respawn or kick the player manually.

2 Likes

i have no idea how to do that please tell me a simple way to understand

2 Likes

Humanoid have .Dead function. You can bind your procedure to that function

Humanoid.Died:Connect(function()
    -- Code runs here
end)

You can use BallSocketConstraint, and attach it to Character HumanoidRootPart and corresponding limbs.

Disable / Destroy Motor6Ds.

Code : Normal script, place it in StarterCharacterScript.

local character = script.Parent

local head = character:WaitForChild("Head")

local humanoid = character:WaitForChild("Humanoid")

humanoid.BreakJointsOnDeath = false

local function ragdoll(target)
	for index,joint in pairs(target:GetDescendants()) do
		if joint:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local a1 = Instance.new("Attachment")
			local a2 = Instance.new("Attachment")
			a1.Parent = joint.Part0
			a2.Parent = joint.Part1
			socket.Parent = joint.Parent
			socket.Attachment0 = a1
			socket.Attachment1 = a2
			a1.CFrame = joint.C0
			a2.CFrame = joint.C1
			socket.LimitsEnabled = true
			socket.TwistLimitsEnabled = true
			joint:Destroy()
		end
	end
	

	--task.wait(5) 
    --target:Destroy()

end

humanoid.Died:Connect(function()
	ragdoll(character)
end)
1 Like

Thanks but the body doesn’t remain there after respawning

2 Likes

There’s tons of good ragdoll modules in the toolbox. Why re-invent the wheel?

1 Like

You’re supposed to :Clone() the character…

local clonedChar = player.Character:Clone()

Put that in your Humanoid.Died event.

2 Likes

Addending this, cloning on its own will not work, because characters are non-Archivable (and thus will return nil on :Clone()). You’ll want player.Character.Archivable = true before you clone.

3 Likes

Umm… I knew that. Forgot to mention it. I had to do that because I have an NPC that does a soul take move on the player.

Can you show me how the script should look with these lines? Just to make sure that i do it right

1 Like

i dont trust the toolbox because my old games were infected because of plugins and free models

1 Like

hellooo??? can u answer please

please don’t ignore me i would apprechiate an answer

You can look it up in the toolbox yourself. Ragdoll module.

I dont know how to use it thats why im asking for some help

I’m not going to teach you how to use the toolbox. You could watch some youtube videos on basic roblox studio info.

i know how to use the toolbox but how do i use that ragdoll module

Put it in startercharacter or starterplayer, or check the module for a guide, probably can find it somewhere in there. It’s super easy, the most popular one afaik. Just put it in starterplayer

I looked up “ragdoll module” in the toolbox but it doesnt even exist

Put in serverscriptservice