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.
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.
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.
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
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)
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
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.