✓ Accepted answer
Not one to spoon feed. Please show us your current code to see what you have tried to do already. But anyways here you go put this as a normal Script in StarterPlayer.StarterCharacterScripts
local debrisservice = game:GetService('Debris')
local body = script.Parent
local player = game.Players:GetPlayerFromCharacter(script.Parent)
local humanoid = body:WaitForChild('Humanoid')
local bodydisposal = 30
humanoid.Died:Connect(function()
if player ~= nil and humanoid ~= nil then
body.Archivable = true
script.Parent = game:GetService("ServerScriptService")
local cloneChar = body:Clone()
cloneChar.Name = player.Name.."'s Deadbody"
if game:GetService("Workspace"):FindFirstChild(cloneChar.Name) then
game:GetService("Workspace"):FindFirstChild(cloneChar.Name):Destroy()
end
wait(0.1)
cloneChar.Parent = game:GetService("Workspace")
local rootPart = cloneChar.HumanoidRootPart or cloneChar.Torso
local clonedHumanoid = cloneChar:FindFirstChildOfClass("Humanoid")
cloneChar:MoveTo(rootPart.Position)
rootPart.Orientation = Vector3.new(90,0,0)
clonedHumanoid.PlatformStand = true
clonedHumanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
clonedHumanoid.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
for i, v in pairs(cloneChar:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = false
v.CanCollide = false
end
if v:IsA("Script") or v:IsA("LocalScript") then
v:Destroy()
end
end
if cloneChar:FindFirstChild("ForceField") then
cloneChar.ForceField:Destroy()
end
body.Parent = game:GetService("ServerStorage")
debrisservice:AddItem(cloneChar,bodydisposal)
debrisservice:AddItem(script,bodydisposal)
wait(1)
if rootPart.Orientation ~= Vector3.new(90,0,0) then
rootPart.Orientation = Vector3.new(90,0,0)
end
end
end)
3 comments
Clone the character on CharacterRemoving.
wont work, i cnat clone
@AlexanderYar, send the script you have to clone the character on characterremoving