How do I get a copy of the players character?

I have a zombie script and I want to make it so that if a player died , their body becomes a zombie , but I don’t know how I can get the players character especially since they are already dead.

1 Like

Can you not just clone the player character which should be in studio?

I did but it says attempt to index nil with name . Here is the script that is inside every player model :
local character = script.Parent

character.Humanoid.Died:Connect(function()
print(“running”)
if character.UpperTorso:FindFirstChild(“infected”) then
wait(5.1)
local pos = character.UpperTorso.CFrame
local cloneOfPlayer = game.Workspace:FindFirstChild(character.Name):clone()
cloneOfPlayer.Name = character.Name…" (Zombie)"
cloneOfPlayer:FindFirstChild(“Humanoid”).Health = 100

	for i,v in pairs(cloneOfPlayer:GetChildren()) do
		if v:IsA("Script") or v:IsA("ModuleScript") or v:IsA("Animation") then
			v:Destroy()
		end
	end
	local cloneOfPunch = game.ReplicatedStorage.animations.punchingAnimation:clone()
	cloneOfPunch.Parent = cloneOfPlayer
	local cloneOfEat = game.ReplicatedStorage.animations.eatingAnimation:clone()
	cloneOfEat.Parent = cloneOfPlayer
	local cloneOfScript = game.ReplicatedStorage.storedScripts.zombieScript:clone()
	cloneOfScript.Parent = cloneOfPlayer
	cloneOfPlayer.Parent = game.Workspace
	cloneOfPlayer.HumanoidRootPart.CFrame = pos
	cloneOfScript.Disabled = false

end

end)

If you want to clone the players looks without compromising the zombie like animations all you have to do is to get the HumanoidDescription of the Player and then ApplyHumanoidDescription to the zombie.

Learn more about HumanoidDescriptions here:

Sorry for the late response.

The error for that is cuz you had three dots when doing this when there should only be two.

image

Fixed that but it still didn’t work