Is it possible to keep old Player.Character after setting Character to something else

Old Player.Character disappears when you set the character to something else.
This is a big problem because I’m making a ragdoll script and I find the need to clone entire model (when you want ragdolls to stay in the game) ridiculous because 1. why, and it results in terrible performance and latency.
In contrast, converting an existing character to a ragdoll is extremely fast.

Edit: Solution causes a weird behavior in my case

3 Likes

Do not actually kill the humanoid, such as preventing health from hitting 0. Then, use :LoadCharacter to respawn them.

I want to keep the ragdoll model for far longer after player respawns

Then you will have to clone it. You could wait for the clone to load before respawning the character (wait(2))

  • Player dies (fake death)
  • Clone character
  • wait(2)
  • Parent clone, load character.

so there is no way to avoid cloning the character because of the engine itself.

I don’t want to clone since cloning the entire R15 character, removing unnecessary stuff and adding all the constraints at the same time is slow and there is a visible latency.

Thanks for the help.

If it’s causing terrible performance, there would also be terrible performance when the player is spawning. I don’t know what your ragdoll script is, but I think you’re doing something wrong.

1 Like

Actually, you could clone just the parts and humanoid, put them in a new model, and then wolla.

local new = Instance.new('Model')
for i,v in pairs(character:GetChildren()) do
   if v:IsA('BasePart') or v:IsA('Humanoid') or v:IsA('Accessory') then
        v:Clone().Parent = new
    end
end
new.Parent = workspace

There is almost no delay with this method, so it has to be your script that is not optimised.

It does work faster than character:Clone()

I still would’ve preferred to use original character if it was a choice.

By “Terrible performance/latency” I meant it took like 0.1-0.2 seconds.

This tidbit of code was something I just tested in studio, and it does keep the old character when calling :LoadCharacter().

local c = player.Character
player.Character = nil
c.Parent = workspace
player:LoadCharacter()

The old character would then be converted into a ragdoll.

4 Likes

Smart, you just removed the reference. I guess the respawn scripts use player.Character. I was unaware you could change this value.

This solution gives me physics lag behavior where body parts could just glitch/spasm and it’s instable.

When it comes to latency, it’s about the same as with cloning the whole character and it cannot compare to near instant ragdoll that you get if you don’t try to get it saved from deletion upon respawn.

I’m still keeping this as a solution because it does keep the old character.

Thanks for the help but perhaps this is how Roblox wants things to be. Quite a shame.

1 Like