Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[SOLVED] How do you clone a dead character?

This is what i'm supposed to do: After you spawn, your body parts are still there.

game.Players.CharacterAutoLoads = false
 
game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(char)
		local h = character:FindFirstChild("Humanoid")
		if h then
			h.Died:connect(function()
				wait(5)
				local clone = h.Parent:Clone()
				clone.Parent = game.Workspace
				player:LoadCharacter()
			end)
		end
	end)
	player:LoadCharacter()
end)

However, I get this error: ServerScriptService.Script:10: attempt to index local 'clone' (a nil value) ...and then it won't clone and spawn me back in. Am I doing something wrong here?

4 comments

0

Put the wait after the Clone() line, else the character could already be gone.

0

@RubenKan It still doesn't work.

3

You will not be able to clone the player as h.Parent is not Archivable ie the the players model. Set this to true before cloning the model. http://wiki.roblox.com/index.php?title=API:Class/Instance/Archivable 

0

Thank you for the helpful info! Anyways, you should post your answer down below, so both of us can get reputation!

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.