How do you clone a character model after a person has died? (please look at the source code)


My problem is quite simple but i’m having a lot of difficulty solving.

  • I want to clone the player that dies and create a clone of it in workspace.

  • The issue is, every time I try to create a clone of the character; It says that it’s nil which I know isn’t true due to the character model still being in the workspace and the script inside the player;

  • I’ve attempted rescripting the entire thing to the same error, I’ve tried calling it from a script outside of the player… leads to the same result.


More Photos

The photo is of my name being printed on line 13, the error, with what line errors; which is line 15.
image


Script

--local Ragdoll = require(game.ServerScriptService["Modules | Ragdoll"].RagdollModule)
local RS = game:GetService("RunService")
local Char = script.Parent
local Hum = Char.Humanoid
local CharName = Char.Name
Char.Humanoid.BreakJointsOnDeath = false
Char.Humanoid.RequiresNeck = false
Ragdoll.RagdollFunctions["Build Rig"].Function(Char)

Hum.Died:Connect(function()
	--if Ragdoll.Settings.Toggles.DeathRagdoll then
		--Ragdoll.RagdollFunctions["Activate Ragdoll"].Function(Char)
		print(Char.Name)
		local CharClone = game.Workspace[CharName]:Clone()
		CharClone.Parent = workspace
		CharClone.Name = CharName.." Ragdoll Clone"
		CharClone.Parent = workspace
		--Ragdoll.RagdollFunctions["Activate Ragdoll"].Function()
		wait(5)
		CharClone:Destroy()
	--end
end)


Thank you for any help you can give me.

Try setting the player’s character’s Archivable property to true before cloning it, then you can set it back to false once you’ve cloned it.

2 Likes