Making clone of Dead Character

Hello! The title might not make sense, and I’ll explain it to you.
I have a script where if you fall off the edge, you die by getting turned to stone (the character gets anchored in the process).
Works well, but the thing is I don’t want the player to actually DIE. I thought of making a clone of the stone/dead character and placing him where the player “died”, but have the actual player in a different, not on the edge spot.

How do I go about this?

SCRIPT:

local Anti = script.Parent.Part
local particles = script.Parent.ParticleEmitter

Anti.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local char = hit.Parent
		local clonedEmitter = particles:Clone()
		
		clonedEmitter.Parent = char.HumanoidRootPart
		clonedEmitter.Enabled = true
		wait(1)
		
		for _, charPart in pairs(char:GetChildren()) do
			if charPart:IsA("BodyColors") then
				charPart.HeadColor3 = Color3.fromRGB(86, 86, 86)
				charPart.LeftArmColor3 = Color3.fromRGB(86, 86, 86)
				charPart.RightArmColor3 = Color3.fromRGB(86, 86, 86)
				charPart.LeftLegColor3 = Color3.fromRGB(86, 86, 86)
				charPart.RightLegColor3 = Color3.fromRGB(86, 86, 86)
				charPart.TorsoColor3 = Color3.fromRGB(86, 86, 86)
			elseif charPart:IsA("Clothing") then
				charPart:Remove()
			elseif charPart:IsA("BasePart") then
				charPart.Anchored = true
				charPart.Color = Color3.fromRGB(84, 84, 84)
				charPart.Material = Enum.Material.Slate
			end
		end
		
		wait(0.25)
		clonedEmitter.Enabled = false
		wait(0.5)
		clonedEmitter:Remove()
		wait(1)
		--past here is where I want the cloning to happen
		char.Humanoid.Health -= char.Humanoid.Health 
	end
end)

TL;DR - Want to make clone of statue/dead player, but have the actual player in safe area.

5 Likes

so how does respawning work if it teleports them to a safe spot when they die??

because if they respawn you can just clone their body and do the effects on it im pretty sure

1 Like

But how would I go about that?
Thing is, I don’t want the player to DIE, but I want the effects to still be there. Kind of like switching bodies.

char.Archivable = not char.Archivable
local clone = char:Clone()
char.Archivable = not char.Archivable

clone is now a clone of the player, Put it in the location you want it to be, and then teleport the real player elsewere

1 Like

Basically, save the player position before it dies and clone the player character and load the save position

2 Likes

Thank you for the suggestions.

But I forgot to say, the player freefalls before they get anchored and turned to stone. The camera still follows the dying player. I’m not the best at scripting so I’m not sure how to go about this.

1 Like

what do you want the camera to do?

Follow the freefalling clone, then after a few seconds after it dies, it goes back to the alive character

Well why does it need to be the clone and not the actuall palyer?

You can clone the player’s character right before it dies, set it to stone, set the player’s camera to the cloned character, play the effects and after the effect is done, set the camera back to the player.

1 Like

To make the effect that it’s “dead”, but then is “revived” once the camera goes back to the actual player.

You could just teleport the player elswere and resets its clothings and body color, or if you want a clone you can change the camera to the clone and than back again,

local cam = game.Workspace.CurrentCamera

cam.CameraSubject = clone.Humanoid
then to get it back
cam.CameraSubject = char.Humanoid

its a server script :frowning:

You can use a remote event to send a signal to the client for when the camera should be set to the cloned character.

1 Like

Well, send a remote then, But That could get som issue with latency. You really should use the actuall player and then give back the collors/ cloth when you teleport away

local model = Instance.new("Model", workspace)
for _, part in pairs(character:GetChildren()) do
		part.Parent = model	
end

this is a much better alternative than cloning the character where he died, every part of the character is put inside a model in the workspace, the character can still respawn after that and you can also clean the model after a while

Just a question, wouldn’t that just affect the alive player?

That’s a bit difficult for me to do

local Anti = script.Parent.Part
local particles = script.Parent.ParticleEmitter

Anti.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local char = hit.Parent
		local clonedEmitter = particles:Clone()
		
		clonedEmitter.Parent = char.HumanoidRootPart
		clonedEmitter.Enabled = true
		wait(1)
		
		for _, charPart in pairs(char:GetChildren()) do
			if charPart:IsA("BodyColors") then
				charPart.HeadColor3 = Color3.fromRGB(86, 86, 86)
				charPart.LeftArmColor3 = Color3.fromRGB(86, 86, 86)
				charPart.RightArmColor3 = Color3.fromRGB(86, 86, 86)
				charPart.LeftLegColor3 = Color3.fromRGB(86, 86, 86)
				charPart.RightLegColor3 = Color3.fromRGB(86, 86, 86)
				charPart.TorsoColor3 = Color3.fromRGB(86, 86, 86)
			elseif charPart:IsA("Clothing") then
				charPart:Remove()
			elseif charPart:IsA("BasePart") then
				charPart.Anchored = true
				charPart.Color = Color3.fromRGB(84, 84, 84)
				charPart.Material = Enum.Material.Slate
			end
		end
		
		wait(0.25)
		clonedEmitter.Enabled = false
		wait(0.5)
		clonedEmitter:Remove()
		wait(1)
        char.Archivable = true
		local clone = char:Clone()
        clone:PivotTo(char.PrimaryPart.CFrame)
        clone.HumanoidRootPart.Anchored = true
        clone.Parent = workspace
        
		char.Humanoid.Health = 0
	end
end)

Sorry for the late reply. I didn’t want the player to actually DIE, I want a clone of the statue player while having the actual player model in a safe spot.