How to change characters (without deleting the old character)

Hello, I want to be able to switch between characters without the old one being deleted. How can I acheive this? Posts I have trie:

This works fine except it loads the character. After removing the :LoadCharacter() function, it still deletes the old character instead of just leaving it alone. I don’t want the old character to get deleted because I still need it later on. The script just sets the player.Character property to my new rig, which deletes the old character. How can I change the player’s character without deleting the old one? Thank you very much!

2 Likes

You can store the old one somewhere and change the character back later.

How do I store it? I tried setting it’s parents to workspace but it did not work. I want to keep the old character at the same position where it was left off.

if Character == YOURNEWCHARACTERHERE then
			YOURFOLDERHERE:FindFirstChild(player.Name).Parent = workspace
			Character = YOURFOLDERHERE:FindFirstChild(player.Name)
		else
			Character.Archivable = true
			
			local oldCharacter = workspace:FindFirstChild(player.Name):Clone()
			oldCharacter.Parent = YOURFOLDERHERE
			
			player.Character = YOURNEWCHARACTERHERE
		end

This should work.

Hello, this worked a while back until last week or so. It stopped working because the character gets deleted (not just parented to nil, but the children of the old character is deleted as well). What can I do to preserve it?

1 Like

If the old character is not the player’s Roblox avatar, then that means it’s already stored somewhere when you join the game. You can just clone it and set it to the player’s character once again.

If it is, then you can just load the player’s character with this: :LoadCharacterWithHumanoidDescription()

That is likely due to the new changes: New Player and Character Destroy Behavior Enabled by Default

In your niche case, you can disable this behavior, however, ensure you are practicing good coding habits by disconnecting connections attached to the Player and all of it’s character lifetime. This property, however, might be permanently enabled “in Q1 2025”, so I would recommend finding another solution by then via cloning (using something like CharacterRemoving will ensure your Character will still be available to clone) or using a different approach of assigning characters.

Ahhhh I see, thank you so much for showing that Roblox actually cared to give us time to adapt. Is it confirmed that they will remove property and the ability to opt-out altogether in 2024? If so, I might have to begin revamping the entire scripting system (which will be a lot of work haha).

Edit: after reading the original post, I want to ask if you have any suggestions for changing how my scripts should work. The player should be able to click on a troop (little npc figure), control it by using wasd naturally, turn camera etc. just like they could normally, and then deselect it (without the npc disappearing).

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