Help clone a players avatar to workspace

anyone know why this doesnt work

wait(4)
local Player = script.Parent
local PlayerClone = Player:Clone()
PlayerClone.Parent = game.Workspace


i have an error of

  Workspace.Cosnez.LocalScript:4: attempt to index nil with 'Parent

this script is in StarterCharacterScripts

2 Likes

Clone.Parent = workspace

Why is this here? It should just me this:

wait(4)
local Player = script.Parent
local PlayerClone = Player:Clone()
PlayerClone.Parent = game.Workspace
1 Like

just removed it, it was from my old version my bad…

2 Likes

Can you try doing print(Player.ClassName)

1 Like

it printed “Model” when i did this

2 Likes


I do get the same error when I try to do this myself.

The code looks right to me, but Its not working.

1 Like

Is this a local or serverscript?
(i did the wrong reply but it doesnt matter)

2 Likes

local Scripttttssss 30 letttteeeerssss

1 Like

It says “Dan_foodz.LocalScript:4” so it’s local

1 Like

It errors for my if I use either:

do Player.Archivable = true in the 3rd line

wait(4)
local Player = script.Parent
Player.Archivable = true
local PlayerClone = Player:Clone()
PlayerClone.Parent = game.Workspace
2 Likes

oh yeah it works thankss youuuu 30 lettters

That works for me:


I have friends now :slight_smile:

2 Likes

and one more thing, how would i make it play a animation? i did this but nothing played.

wait(4)
local Player = script.Parent
Player.Archivable = true 
local PlayerClone = Player:Clone()
PlayerClone.Parent = game.Workspace
local FindPlayer = game.Workspace:WaitForChild(game.Players.LocalPlayer.Name)
local Humanoid = FindPlayer:WaitForChild("Humanoid")
local Anim = Humanoid:LoadAnimation(script:FindFirstChildOfClass("Animation"))
PlayerClone.HumanoidRootPart.CFrame = game.Workspace.Dummy.HumanoidRootPart.CFrame
wait(2)
Anim:Play()
1 Like

Place the animation inside of the character. And do it in a normal script because the localscript wont run in workspace.

oh alright thanks ill do it and tell u what happens

Yeah make sure to add a wait before you do it so that you know that the character already spawned in.

so i clone the script and animation inside of the copy?

Make a new script and you will have to load the animation and play it there

i think i did it wrong, i cloned the script which has the animation inside of it to the cloned player then i Enable the script and nothing plays or prints

Local script

wait(4)

local Player = script.Parent

Player.Archivable = true 
local PlayerClone = Player:Clone()

local ScriptClone = script.AnimationPlayer
local ScriptCloneTO = ScriptClone:Clone()

ScriptCloneTO.Parent = PlayerClone
PlayerClone.Parent = game.Workspace
PlayerClone.HumanoidRootPart.CFrame = game.Workspace.Dummy.HumanoidRootPart.CFrame
PlayerClone:WaitForChild("AnimationPlayer").Disabled = false

script cloned inside ClonedPlayer

wait(8)
local animation = script:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)
dance:Play()

``` it enables itself once cloned inside the clonedplayer