How to clone player when dying and appear on his body?

Hello, I would like to know how I can make the player when he dies a copy is created on the ground and that the player after a few seconds appears on his body, how is this possible?

starter character script:

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character.Humanoid.Died:Connect(function()
			local body = game.ReplicatedStorage.Body:Clone()
			body.Parent = workspace
			body:SetPrimaryPartCFrame(character:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(0,90,0))
		end)
	end)
end)
1 Like

Try using HumanoidDescription | Documentation - Roblox Creator Hub so when u clone a body u apllied the HumanoidDescription by the player which died which mean u add its accesseory shirt and everything he wears

1 Like

what am i doing wrong? :frowning: I need to make the dummy take the description of the player who dies

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character.Humanoid.Died:Connect(function()
			
			local humanoid = script.Parent.Humanoid
			humanoid:ApplyDescription(game.Players:GetPlayerFromCharacter(player))
		end)
	end)
end)

I think this might do what you want:

game:GetService("Players").PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		
		local dummy = workspace:FindFirstChild("_"..player.Name)
		if dummy then
			game:GetService("RunService").Heartbeat:Wait()
			character:SetPrimaryPartCFrame(dummy.PrimaryPart.CFrame)
			dummy:Destroy()
		end
		
		character.Humanoid.Died:Connect(function()
			local description = character.Humanoid.HumanoidDescription
			local new = script.Dummy:Clone() --Change this to be the dummy character you are cloning.
			new:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0, 1000, 0)))
			new.Name = "_"..player.Name
			new.Humanoid.DisplayName = player.Name
			new.Parent = workspace
			new.Humanoid:ApplyDescription(description)
			new:SetPrimaryPartCFrame(character.PrimaryPart.CFrame)		
		end)
	end)
end)

Hope this is what you were looking for!
:smiley:

1 Like

It doesn’t work, I need the dummy to appear in the position that the player died :frowning:

image

script

game:GetService("Players").PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)

		local dummy = workspace:FindFirstChild("_"..player.Name)
		if dummy then
			game:GetService("RunService").Heartbeat:Wait()
			character:SetPrimaryPartCFrame(dummy.PrimaryPart.CFrame)
			dummy:Destroy()
		end

		character.Humanoid.Died:Connect(function()
			local description = character.Humanoid.HumanoidDescription
			local new = game.ReplicatedStorage.THISDUMMY:Clone() --Change this to be the dummy character you are cloning.
			new:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0, 1000, 0)))
			new.Name = "_"..player.Name
			new.Humanoid.DisplayName = player.Name
			new.Parent = workspace
			new.Humanoid:ApplyDescription(description)
			new:SetPrimaryPartCFrame(character.PrimaryPart.CFrame)		
		end)
	end)
end)
1 Like

Try without this line, set all parts of the Dummy CanCollide = true and Anchored = false, set HumanoidRootPart as the Primary part for THISDUMMY.

if dummy then
			game:GetService("RunService").Heartbeat:Wait()
			character:SetPrimaryPartCFrame(dummy.PrimaryPart.CFrame)
			dummy:Destroy()
		end

This piece of code (^) is destroying the Dummy once you respawn, are you aware of this?