Im trying to write a script that duplicates your character then sets your character to the new one, but i keep getting this error ':5: attempt to index local 'cclo' (a nil value)' with this script:
1 | local plr = game:service( 'Players' ).LocalPlayer |
2 | plr.CharacterAdded:connect( function () |
3 | local olc = plr.Character |
4 | local cclo = olc:Clone() |
5 | cclo.Parent = workspace |
6 | plr.Character = cclo |
7 | end ) |
btw its in a local script and it needs to be in a local script.
It does not need to be in a local script. You’re also using lots of deprecated code. Let me help you.
It doesn’t clone because the Character’s Archivable
property is set to false.
Set it to true, and it will work.
Put this code in a server script:
1 | local PlayersService = game:GetService "Players" -- GetService not service |
2 |
3 | PlayersService.PlayerAdded:Connect( function (player) |
4 | player.CharacterAdded:Connect( function (character) |
5 | character.Archivable = true -- set to true FIRST!! |
6 | character:Clone().Parent = game.Workspace |
7 | end ) |
8 | end ) |