Unable to clone character

Alright so I am working on something that requires the players character to be cloned. As of right now it’s just a localscript under starterplayer > statercharacterscripts. Here is the script.
script.Parent.Archivable = true; script.Parent:Clone().Parent = workspace
Setting the character to archivable does nothing. I even tried setting it to true on the server to see if it was just locked for the client but it isn’t. Anyone know how to fix this issue?

1 Like

Hello!

Firstly, I do not really find it wise to clone the script’s Parent. The issue is that you’re cloning the same script alongside the parent Instance itself, meaning that there will be multiple same scripts, and if some line of code runs automatically (without needing to be triggered extra), it’s gonna run again and again.

Therefore, you could try putting the script outside of the Instance (script.Parent) and changing certain lines of your code, as the first solving method.

Another potentional solving of this issue could be this:

local cloneInstance = -- Route to your Instance here
cloneInstance:Clone()
cloneInstance.Parent = workspace
1 Like

Yeah I tried both already. It just continues to not work because roblox wont allow me to enable archiving on the character.

It should allow you, it works for me. Does it return any error?

Nope, that’s the weird thing. No errors and it doesn’t even set Archivable to true. It’s the strangest thing ever.

I can just hit Play Solo and run:

game.Players.LocalPlayer.Character.Archivable = true game.Players.LocalPlayer.Character:Clone().Parent = game.Workspace

in the command bar, and it clones my character just fine. You should probably try isolating this issue from the rest of your game code, to see if something else is interfering. Making a local clone of a character works like it always has.

Note that a classic LocalScript will only run if it’s inside the model that is actually the LocalPlayer.Character. So the clone, even though it will have a copy of the cloning script, will not clone itself and start an infinite chain of cloning, because none of the clone’s localscripts can execute. A Script with RunContext of Client is another matter, that can repeat, and if the code in question was the only thing in the script, with no wait statements, it would probably lock up studio. It would also need to check if script.Parent was actually a Model, otherwise it would try to clone StarterCharacterScripts first and immediately fail.