Cloning the players character when joined the server

  1. What do you want to achieve? Keep it simple and clear!
    I want to clone the players character and store the clone in a folder inside of ReplicatedStorage

  2. What is the issue? Include screenshots / videos if possible!
    When i try to do it i get this error:
    09:54:57.674 ServerScriptService.Script:3: attempt to index nil with ‘Clone’ - Server - Script:3
    09:54:57.674 Stack Begin - Studio
    09:54:57.674 Script ‘ServerScriptService.Script’, Line 3 - Studio - Script:3
    09:54:57.674 Stack End - Studio

Here is the script:

game.Players.PlayerAdded:Connect(function(plr)
	local char = plr.Character
	local charclone = char:Clone()
	charclone.Parent = game.ReplicatedStorage.PlayersCharacters
end)
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have looked on youtube, asked chatgpt and read on the roblox developer forum I didnt find anything on both youtube and the devforum but chatgpt gave me a code which gave me the same error
2 Likes

the issue is characters are not archivable, meaning they cannot be cloned. it’s a very easy solution:

game.Players.PlayerAdded:Connect(function(plr)
	local char = plr.Character

	char.Archivable = true
	
	local charclone = char:Clone()
	charclone.Parent = game.ReplicatedStorage.PlayersCharacters
	
	char.Archivable = false
end)
1 Like

when i tried your code i got this error:

10:43:12.960 ServerScriptService.Script:4: attempt to index nil with ‘Archivable’ - Server - Script:4
10:43:12.960 Stack Begin - Studio
10:43:12.960 Script ‘ServerScriptService.Script’, Line 4 - Studio - Script:4
10:43:12.960 Stack End - Studio

But when i put your code inside of CharacterAdded then it worked! thanks man

1 Like

LOL thats my bad i can’t believe i didn’t notice that. glad to help :upside_down_face:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.