How could i make a character switching system?

I have had an idea for a game mechanic where the player will be able to switch to a different character such as in Zelda four swords on the Nintendo DSi where pressing the left or right shoulder buttons switched the character, while the old character stays to be switched back into.

I know this sounds confusing so:

player presses q > Switch to character 1
player presses e > Switch to character 2

While the player is Character 1, character 2 follows character 1.
While the player is Character 2, character 1 follows character 2.

3 Likes

Ok so you will need to use player.Character.Humanoid:ApplyDescription() and UserInputService.

For the follow concept you can use this system.

local inputs = {
    [Enum.KeyCode.Q] = --[[character 1 description]],
    [Enum.KeyCode.P] = --character 2 description
}

UserInputService.InputBegan:Connect(function(input, isTyping)
    if chat then --checks if the player is typing, if true return.
        return
    end

    if inputs[input.KeyCode] then --checks if the inputs table has a value equal to the pressed key
        humanoid:ApplyDescription(inputs[input.KeyCode]) --if the inputs table has a value with the pressed key loads the corresponding description
    end
end)
3 Likes

I want it to be like i possess the other character, the first character remains and follows the character that i possessed.

1 Like

Your idea is complicating, not much to go off of. You keep contradicting yourself so, could you please explain to me in detail as to what you want to do?

The secret lies in the Humanoid. If the humanoid swaps ownership, the model dies. To avoid that, add the humanoid after you swap bodies, and I assume the same is true to leave a body. Remove the Humanoid before exiting the body to prevent its death. (I’ve never had to do this, so let me know if it fails. I’ll stop recommending it! You could always clone the “leaving” body if this does not work.)

This is honestly a cool idea it made me question, as my game idea is going to be a single player experience however at the start you can pick either of the two main storyline characters, what ever you pick will determine what character is the npc that works with you and and has a role in the story.

Your question made me have an idea, instead of only being able to control the one character, how would I be able to have throughout the story you control the other character for a bit, while the two characters are present.

My idea basically will have you doing most of the stuff while the other character stays around “camp” but also has roles throughout, like say they go off to one part theoretically, and you meet them , Or they follow or guide you to an area while doing things like helping fight of an enemy being if I decided to do that.

1 Like

What you want to achieve is not very clear, please explain it better

an example:

an example of the mechanic can be found in this video.
A button is pressed to change character.
But the other character doesnt dissapear. Almost as if you possess the other character

This doesn’t make any sense. Why would only one character have a humanoid? Both characters would need a humanoid to complete @Smokey_Supra’s request. These two humanoids are also a necessity since he’s asking for the additional character to follow the one you are currently possessing. Here is a description of humanoid:move which is something you could use to follow the main or possessed character. Read through it as you should be able to make something out of it. As for the actual possessing aspect, the example that was given is in 2D. Will your game be 2D based or 3D?

2 Likes

Only during the change of ownership of the model do you need to remove the humanoids. They trigger death.

I’d say make it switch occasionally sort of like The Man of medan. That will give you a good idea.

I don’t think I understand what you’re trying to say. Why are the humanoids being removed at all? What do you mean by “change of ownership of the model.” I don’t see how any of this relates to what I’m saying or the topic-

If you have any questions on my solution, ask in my attached solution. I’m pretty sure I left code, videos and a full explanation in that thread.

The ONLY thing you have to do to switch models without killing off the models is to remove the Humanoid during the switch. Nothing else.

I don’t mean to watch a 41 minutes long viedeo… please explain it with a drawing or something.

1 Like

What does cloning the player on a horse have to do with swapping/possessing different characters? You kind of have no context to your solution, I could see how your cloning system would work since the player could only technically control one character, but then again the easiest solution would be to make the non-possessed character swap appearances with the one that is currently possessed. Could you give a full explanation as to how this would help at all? I’m not saying it’s bad or anything, I’m just really confused.

Would you want me to make an example of what I’m thinking you might be asking? (Like code it all) or do you want me to just give you some insight as to how you could go about it.

Guys think how lego games are like it you ever played them, I understood exactly what the op was talking about

1 Like

it isnt all the video, it can be seen at the start. The player can switch between red and green character. But if player is red character, green character follows red character, if player is green character, red character follows green character.

Exactly!
This person here knows all.

1 Like