Help Changing Player's Character after clicking a button

Im trying to make a player’s character change to another character after clicking a button and looping until they leave or it switches again. I tried this.

rs.Events.Play.OnServerEvent:Connect(function(plr)
	if not plrspawned[plr] then
		local customCharacter = game.ServerStorage.Char:Clone()
		plr.Character = customCharacter
		customCharacter.Parent = game.Workspace
		plr:LoadCharacter()
		plrspawned[plr] = true
	end
end)
3 Likes

Your going to need to do these things:

  1. game.Players.CharacterAutoLoads needs to be off, otherwise the game will automatically replace the Character with their default form upon respawn.
  1. The name of the character must match the name of the player

  2. The new character must include a Humanoid and a Head, as well as the animation and sound scripts if you want the character to have animation and sound.

Also LoadCharacter() will just reload the character, replacing your custom character with their default form.

5 Likes

is there a way to make it display guis when characterautoloads is off? nevermind i think i can do this

1 Like

You’re going to have to just manually copy over the GUIs into the Player’s PlayerGui as Roblox doesn’t copy over the items from StarterGui until the character spawns. They have already stated this is a bug and are working on it, but that’s been almost a year now.

2 Likes

alr i just need to make respawning automatic

1 Like

Make sure you set the Player’s Custom Character only after they are spawned using LoadCharacter(). Otherwise the character will just respawn in their normal avatar.