What you want to achieve is not very clear, please explain it better
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?
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.
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
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.
just an insight as to how i could go about it please
Character 1 is the player. Character 2 is the horse (the human is cloned on top of it, because eventually I want ANY human to clone on top). That’s my character switching system.
The only thing I did not do with my code was try to keep Character 1 alive. Obviously in this request, you want to hop between 1 and 2 and both stay alive.
To keep #2 alive, remove the Humanoid.
To keep #1 alive:
Option 1: Don’t bother! Clone Character 1, make its parent game.Workspace. Since the client never controls the clone, it does not die.
This took 5 lines of code to add a new clone:
Option 2: Save the old model! This was not as hard to do as I thought. When the character swap happens, the old model now has a parent of “nil” which is why it disappears/dies. Just set the parent to game.Workspace after the swap and it will come back.
In this example, I threw a test dummy out there (right), and just swapped bodies (remove humanoid of the target, of course, to prevent death/respawn).
2 lines.
local oldchar = char -- only new lines
local test = game.Workspace.Human --human does not have a Humanoid in it
player.Character = test
local hum = Instance.new("Humanoid")
hum.Parent = player.Character
oldchar.Parent = game.Workspace -- only new lines
None of this addresses the cleanup work required (setting new animations for new Humanoids, resetting the camera, etc) but the switch is complete.
Yes, I could see how this could be useful. But check the original request. He wants the other character to follow the main/possessed one after switching. This would have worked for a stationary character switching system, and I’m certain you can apply it here too. My opinion hasn’t changed, still not sure as to how this relates to the topic.
-
For the actual character switching to work, we’ll need to use a gui button, context action service or user input service. I’ll be using UserInputService for this. We can easily create a function for InputBegan and then check to see if our desired key is pressed.
if input.UserInputType == Enum.UserInputType.Keyboard then
local key = input.KeyCode
if key == Enum.KeyCode.thekeythatyouwant then
code here
(input being the variable in our function) -
The way I’m thinking about switching the characters is simple. We could just swap the appearances of both the characters to give the effect of them switching. You could create an array of all the accessories or just loop through them. Then clone and weld them to each character and have a separate loop to destroy the old ones. I recommend having some sort of naming system so that your script can detect which ones to destroy and which ones to keep. Here’s a post that could help you with this.
-
Finally, to make the extra character trail off the possessed character, you could just use humanoid:move() in a loop with some offset.
Thats all I could think of. This is a pretty new concept to me and of course I’m not perfect so if you have any ideas feel free to tell me them.
You can do something like:
Player.Character = CharacterA
Player.Character = CharacterB
And each time you set the .Character property of the Player to a new model you will need to set the network ownership of the characters to their appropriate owners, Server for A when you switch to B and B to the Player and vice versa.