Cosnez
(Cosnez)
December 12, 2021, 4:35pm
#1
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
Dan_foodz
(Dan_foodz)
December 12, 2021, 4:38pm
#2
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
Cosnez
(Cosnez)
December 12, 2021, 4:39pm
#3
just removed it, it was from my old version my bad…
2 Likes
Can you try doing print(Player.ClassName)
1 Like
Cosnez
(Cosnez)
December 12, 2021, 4:41pm
#5
it printed “Model” when i did this
2 Likes
Dan_foodz
(Dan_foodz)
December 12, 2021, 4:41pm
#6
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
Cosnez
(Cosnez)
December 12, 2021, 4:42pm
#8
local Scripttttssss 30 letttteeeerssss
1 Like
It says “Dan_foodz.LocalScript:4” so it’s local
1 Like
Dan_foodz
(Dan_foodz)
December 12, 2021, 4:43pm
#10
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
Cosnez
(Cosnez)
December 12, 2021, 4:47pm
#12
oh yeah it works thankss youuuu 30 lettters
Cosnez
(Cosnez)
December 12, 2021, 4:56pm
#14
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.
Cosnez
(Cosnez)
December 12, 2021, 4:58pm
#16
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.
Cosnez
(Cosnez)
December 12, 2021, 4:59pm
#18
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
Cosnez
(Cosnez)
December 12, 2021, 5:11pm
#20
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