Cloning character after death with animation not working

My goal is to prevent the character body from getting deleted after respawning, I am currently trying to do this via the Clone function, this method works fine on a NPC rig

But when doing it for a player-character the clone seems to be getting out of the animation, is there anyway to fix this?

NPC Script (Works Fine)

local Char = script.Parent
local Humanoid = Char.Humanoid
local Animator = Humanoid:WaitForChild("Animator")

local Track = Animator:LoadAnimation(script.Animation)
repeat task.wait() until Track.Length > 0

Track:Play()

task.wait(1)

Humanoid.Health = 0
Char.HumanoidRootPart.Anchored = true

task.wait(1)

Char.Archivable = true
local Clone = Char:Clone()
Clone.Name = "Cloned"
local OriginalCF = Clone:GetPivot()
Clone:PivotTo(CFrame.new(0,-10,0))
Clone.Parent = workspace
task.wait(0.1)
Clone:PivotTo(OriginalCF)
Char:Destroy()

Player Character Script (Does not work, and is executed on the server)
Players → CharacterAutoLoads is also set to false

task.wait(1)
local Player = game.Players.Thedagz
Player:LoadCharacter()
task.wait(1)
local Char = Player.Character
local Humanoid = Char.Humanoid
Humanoid.BreakJointsOnDeath = false
local Animator = Humanoid:WaitForChild("Animator")

local Track = Animator:LoadAnimation(script.Animation)
repeat task.wait() until Track.Length > 0
Track:Play()

task.wait(3)
Humanoid.Health = 0
Char.HumanoidRootPart.Anchored = true

task.wait(3)

Char.Archivable = true
local Clone = Char:Clone()
local OriginalCF = Clone:GetPivot()
Clone:PivotTo(CFrame.new(0,-10,0))
Clone.Parent = workspace
task.wait(0.1)
Clone:PivotTo(OriginalCF)
Char:Destroy()

Fixed simple solution is to just anchor every part, not sure what causes the problem doe

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.