How do i change player character without the old one being deleted?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

Changing characters without making the old one destroy itself…

  1. What is the issue? Include screenshots / videos if possible!

I cant figure out a reason to how i would do it.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Tried messing around in studio and asking ppl.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Im trying to change a players character without the old one deleting (would be bad if i clone it cuz if the player should play a smooth animation the whole time it would 100% “lag” after its cloned and the animation played again)

Is there some way i can disable this?

I was making a test ride and simply moving impornant things from your character to old character, and removing accesories, shirts, shirt graphics from old character and moving those from new to old.
To make it easier use for loops and :IsA().

1 Like

just writing this off the cuff…don’t expect it to run without errors, but it should get you in the right direction :+1:

In server:

local cachedCharacters = game.ReplicatedStorage:FindFirstChild("CachedCharacters")
if cachedCharacters == nil then
    cachedCharacters = Instance.new("Folder")
    cachedCharacters.Name = "CachedCharacters"
    cachedCharacters.Parent = game.ReplicatedStorage
end

local function onPlayerAdded(player)
       local character = player:WaitForChild("Character",10)
       local root = character:WaitForChild("HumanoidRootPart",10)
       if cachedCharacters:FindFirstChild(player.Name) == nil then
           character.Archivable = true --required to clone the character
           local storedCopy = character:Clone()
           character.Archivable = false
           storedCopy.Name = player.Name --i think this is redundant?
           storedCopy.Parent = cachedCharacters
       end
end

game.Players.OnPlayerAdded:Connect(onPlayerAdded)

Now the following should work in any script, local or server

local function getOriginalOutfit(player)
     return game.ReplicatedStorage.CachedCharacters:FindFirstChild(player.Name)
 end
1 Like

I just changed the parent of the character instantly after it gets deleted (because its not garbage collected)

2 Likes