How do i clone player character

Hi i want to clone player character but it didn’t work

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(Chr)
		local Clone = Chr:Clone()
		Clone:SetPrimaryPartCFrame(CFrame.new(Chr.PrimaryPart.Position))
	end)
end)

the error is :ServerScriptService.Script:4: attempt to index nil with ‘SetPrimaryPartCFrame’

You don’t have to use SetPrimaryPartCFrame, you can just clone the character and put it into workspace, if you’d like to move the character you can use :MoveTo.

Like This:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(Chr)
		local newPlayer = Chr:Clone()
        newPlayer.Archivable= true -- Make sure archivable is true
		newPlayer.Parent = workspace
	end)
end)

And you can move to by saying

newPlayer:MoveTo(position)

try and propogate the model and data to a seperate model then pack that idk

did not work now it print attempt to index nil with ‘Archivable’

1 Like

Oh I see I made a mistake, now this should work:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(Chr)
		
		Chr.Archivable = true
		
		wait()
		
		local newPlayer = Chr:Clone()
		newPlayer.Parent = workspace
		
	end)
end)
3 Likes

Since the player’s character itself need to have archivable to true before cloning it, also, that wait is required so the script has time to load the character propperly.

5 Likes