I'm trying to clone the players avatar, but it won't work

I’m trying to clone the players avatar, but it doesn’t clone the avatar and it won’t let me change anything about it. I tried printing the name of “Character”, but it also gives back an error saying Name is nil.

local CharacterModel = game.Players.LocalPlayer.Character
		
print(CharacterModel.Name)
		
local Character = CharacterModel:Clone()
Character.Parent = workspace
Character.Name = "Clone"

Error:

  Players.blushclips.PlayerGui.Ragdoll:17: attempt to index nil with 'Parent'

Yes it’s in a localscript. I’ve never tried to clone a avatar before, so I’m not sure if you’re can clone the avatar directly or if you have to reconstruct the avatar.

1 Like

Try setting the “Archivable” property of the character to true. By default it’s set to false, which makes it un-clonable. Also, add in some kind of wait, as the character model is usually not loaded when the script runs.

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
character.Archivable = true
local characterModel = character:Clone()
character.Archivable = false

characterModel.Name = character.Name.. " Clone"
characterModel.Parent = workspace

EDIT: Some clarification, the character model’s Archivable property is set to false by default. This is not the case for other Instance’s though, as they have an Archivable property set to true by default.

5 Likes

Issue was with the archivable value. Thanks!

2 Likes

What you could do is place your script in ServerScriptService. What you’ll need to do is make it so that once the player joins, it’ll clone like so:

game.Players.PlayerAdded:Connect(function(player)

local CharacterModel = player.Character
		
print(CharacterModel.Name)

player:Clone().Parent = game.Workspace
end)
1 Like

A server script is completely unnecessary in this case, and in your code you haven’t even set the Archivable property to true, which needs to be as by default a character model has a Archivable property of false by default.

1 Like

Hey, sorry to ask you but do you know any tips you could give me on changing the players camera subject from the clone to the original avatar because when the clone is made the camera goes to the clone instead of staying with the original avatar.

Wait NVM I found out, thansk though.

You could save a variable of the old CameraSubject, then once it’s cloned, just set the camera subject of the player to the old one.