Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

setting a players character to a custom character does not work?

game.Players.PlayerAdded:Connect(function(plr)
	plr.Character = game.Workspace.Dummy
end)

Im trying to set a players character to a character in the workspace, but when I run the game the custom character disappears and the players character remains unchanged.

1 comment

0

you can modify the player's CharacterAppearanceID then run Player:LoadCharacter()

2 answers

✓ Accepted answer

In order to load a custom static character instead of each player's personal one, Take the character model that you'd like to use, in this case, "Dummy", rename it to "StarterCharacter", and then drop it into the folder known as StarterPlayer.

EDIT: If you want to load different characters, your best bet is to turn off CharacterAutoLoads of Players, and handle the loading yourself. So simply decide which model you'd like to use for the character (make sure it's named "StarterCharacter"), place the model in StarterPlayer, call :LoadCharacter on the player, and then take the StarterCharacter model back out. Repeat the process for whenever you load someone's character. (most often when they join or respawn)

1 comment

0

that only works for one single "StarterCharacter", I want to change the players character to different characters.

So I made a compact old fashioned character morpher, fully commented for its easy understanding. Just add in 'playersToModifyIds' the userId of the users who will have their character changed and change the directory of 'characterModel' to the model of your custom character.

local playersToModifyIds = {3807724, 255752} -- UserId's of players to have their character appearance overwritten
local characterModel = game.Workspace.StarterCharacter -- Desired character model to change the player's into

game.Players.PlayerAdded:Connect(function(player)
	-- Check if player is to have its character changed
	for i, playerId in pairs(playersToModifyIds) do
		if playerId == player.UserId then
			-- Disable their default character appearance
			player.CanLoadCharacterAppearance = false
			
			-- On player spawn, change their character to that of characterModel
			player.CharacterAdded:Connect(function(character)
				-- Copy characterModel's accesories to player's character
				for i, part in pairs(characterModel:GetChildren()) do
					if part:IsA("Accessory") or part:IsA("CharacterAppearance") then
						local clone = part:Clone()
						clone.Parent = character
					end
				end
				-- Remove the player character's head shape and face
				for i, part in pairs(character.Head:GetChildren()) do
					if part:IsA("DataModelMesh") or part:IsA("FaceInstance") then
						part:Destroy()
					end
				end
				-- Copy characterModel's head shape and face to player's character	
				for i, part in pairs(characterModel.Head:GetChildren()) do
					if part:IsA("DataModelMesh") or part:IsA("FaceInstance") then
						local clone = part:Clone()
						clone.Parent = character.Head
					end
				end
			end)
			break
		end
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.