Changing player's character while in-game

Hello.

So, I want to make, that when player clicks button it will change their character, for one of my characters.
Meaning, I’ll give them my R6 Character made by me.

I asked on many places what to do, but I was told to change only clothing, which is something I don’t want to do, because I want them to be same as the Character I made.

It is possible to do it through StarterCharacer, but I have more example characters, thus I can’t use that.

Sorry if this was already posted, but I didn’t find it anywhere.
Thanks for reading and have a nice one.

EDIT: I actually want it when the player joins team. But it is still same. :slight_smile:

12 Likes

This question is kind of common, and honestly from what I’ve seen there was never a perfect answer to it.
Because any found solution had a small flaw in it.

For example, a very simple way to do this is: you replace the first StarterCharacter model and replace it with the other character you want, than you kill the character or player:LoadCharacter() which would respawn the character without killing him and voila he will have his new character, but this was a hacky way of doing it that wasn’t secure nor stable, since the StarterCharacter is supposed to represent the starting character for ALL players and not just one, so you have to replace the startercharacter from a local script, which can be easily accessed by an exploiter. And the whole idea of replacing the startercharater seemed kind of wrong even though it would work as wanted.
So another idea people came up is changing the player.Character, which is much simpler and it literally only required you to

player.Character = the new character

Which offered more simplicity and security but was is well unstable.

Here is a link that might help

8 Likes

The topic you sent is saying that the method shouldn’t be relied on.

And doing player.Character = Model…?
then player:LoadCharacter()

Would this be the correct way?

2 Likes

Yeah that’s what I said, I told you that method to show that even though it’s correct it’s not advised. I showed that exact post because that method was used so just a proof that it works.

But I recommend doing the player.Character = <new character> method, and I don’t think you even need to :LoadCharacter() I assume changing the character will respawn the player, if it doesn’t, use LoadCharacter().

Another thing, when the character respawns it might look a bit not professional so it is a cool idea to make some camera manipulation to prevent the player from seeing the respawning character that just falls from the sky.

4 Likes

No, doesn’t work.

		local newCharacter = workspace.Characters.Finland
		newCharacter.Parent = workspace
		player.Character = newCharacter
		player:LoadCharacter()	

This is how I do it.
And this spawns the same character again.

3 Likes

Don’t do player:LoadCharacter(). This will destroy the player’s current Character and recreate the default one.

7 Likes

Just use humanoid descriptions, here is the API HumanoidDescription | Documentation - Roblox Creator Hub, make a humanoid description to match the character you created, then apply it when the button is pressed

10 Likes

if you spawn in the character you want it to be changed to in the workspace. set the cframe of the rootpart to the current characters cframe and delete the current character. in players change the players character property to your new one. then change the camera subject of the workspace.currentcamera to new characters humanoid (on the clients side). this should work i guess :slight_smile:

3 Likes

I found a solution that seems to work perfectly, use it in most of my games.

You can use this code (in a server script. This is just an example, but it assumes a remote was fired from the client to the server, carrying the name of the character that needs to be changed into. That character should be located in ReplicatedStorage):

local remote = --remote

remote.OnServerEvent:Connect(function(sender,characterName)
    local OldChar = sender.Character
    local newChar = game.ReplicatedStorage:FindFirstChild(characterName.Name):Clone()
    newChar.HumanoidRootPart.Position = Vector3.new(OldChar.HumanoidRootPart.Position)
    newChar.Parent = game.Workspace
    sender.Character = newChar
    OldChar:Destroy()
end)

This YouTube tutorial: https://www.youtube.com/watch?v=1fLyoEzK3Gw&list=LL&index=1

I am late, but this should help, good luck!

4 Likes

Here, I made a post with this topic:

3 Likes

I found a way to do it. The code below is an example but can be configured to meet your needs. The key to my approach is to simply change the character model via “player.Character”

local Players = game:GetService("Players");
local char = --custom character;
Players.PlayerAdded:Connect(function(player)
  while true do
        player.CharacterAdded:Wait();
        local character = char:Clone();
        player.Character = character
        character.Parent = workspace
  end
end)

note: its very important to assign the character before parenting it to workspace in order for the camera to automatically readjust

12 Likes

‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎

1 Like

I tried it but after i change the character i can’t move help ple

1 Like

sorry it took so long to reply; did you find a solution to your problem?

1 Like

No, by the way, I was using a LoadCharacter plug in. But I can’t walk

1 Like

you still need to move the cframe and primary part .

1 Like

? ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎‎‎

1 Like

see this to understand what im talking about .

2 Likes

Sorry for reviving this topic, but this part won’t attach the camera to the character. It just plain doesn’t work. Any fix for this?

oof, that script is old, some things might have changed, i dont know how to fix it sorry.
Try changing the CameraSubject to Humanoid instead, that is the default when a normal character spawns, and check if the script is running correctly.