I’ve recently been inspired by how Genshin Impact handles their party system and wanted to recreate the character swapping system in ROBLOX, however I can’t wrap my head around how I should handle this.
My first approach was simply to clone the new character, delete the old one and set the Player.Character to the new model. Now while this does work, it does bring a few problems to the table, like the camera resetting position, however that is easily fixable.
The major problem is that now due to the replacement, the CoreScripts act as if the player respawned (because it technically did) which stops character movement and would fire any CharacterAdded events.
I was initially planning to just change my code to work around this and match the velocity from the old character onto the new character. My next idea was to bundle the current team into one character and only let the one that is currently supposed to be on the field be visible. I’m not sure how smart this would be and I feel like there is a much more elegant solution, however I’m not sure. Any suggestions? No need for code samples
Maybe you could morph the character by changing it to look like the new character instead of completely replacing it. Might be hard to make it look smooth though.
That would definitely fix the velocity and events firing, but I feel like that would limit the way characters look as morphing one completely different character into another would limit to each character being pretty much equal in build.
I mean a completely different character as in a character which does not share the same joints and limbs as the default roblox character. Example would be from a normal human to something like a spider
What about removing the children of the character model and then adding all of the new character’s children to it? Basically replacing everything except the parent model itself… Hopefully that wouldn’t trigger CharacterAdded events since Player.Character is still the same model, in theory atleast
This sortof points towards the idea I mentioned with having all characters combined into one and just only showing specific ones. You are right in the fact that it wouldn’t trigger CharacterAdded events I think. I’m going to try this but I will leave the discussion open incase someone finds a more elegant solution. Thanks for your help
Doing anything with Roblox characters is the most irritating experience and trying to hotswap a player’s character is definitely one of those things. One suggestion I received when trying a similar thing in the past was to gut the character of children but not actually switch the model.
Check if this thread gives you any ideas:
(Nice, realise it’s the same thing that was suggested above.)