|
| 05 Jun 2016 07:36 PM |
Is there a way to clone a player in workspace using a script?
#code ypcall(function() workspace.SuspiciousItems:Destroy() end) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 07:40 PM |
Yup
charClone = workspace.Player1:clone() charClone.Torso.CFrame = workspace.Player1.Torso.CFrame+Vector3.new(0,0,4) -- so that they don't clip and fling inside the player charClone.Name = workspace.Player1.Name
something to that effect
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 07:42 PM |
It says line 2 is nil? (I changed it to my username)
Are you sure that its right?
#code ypcall(function() workspace.SuspiciousItems:Destroy() end) |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 07:44 PM |
Just trying this gives a nil value:
workspace.AVeryNerdyDude:clone().Parent = workspace
#code ypcall(function() workspace.SuspiciousItems:Destroy() end) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 07:44 PM |
What does it say is nil in line 2?
How are you testing this?
If the player named Player1 exists in the workspace at the time this script was fired, it should work.
Maybe try waiting for the player
charClone = workspace:WaitForChild'Player1':clone() charClone.Torso.CFrame = workspace.Player1.Torso.CFrame+Vector3.new(0,0,4) -- so that they don't clip and fling inside the player charClone.Name = workspace.Player1.Name
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 07:45 PM |
I mean, what does the actual output say?
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 07:46 PM |
If you're in PlayTest I'm pretty sure you have to designate yourself as either Player or Player1
Just make sure you're fully loaded and your 1 line should work, provided everything else is in the right spot
workspace:WaitForChild'YOU':clone().Parent = workspace
is totally fine <3
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 07:47 PM |
"Attempt to index global 'charClone' (a nil value)"
#code ypcall(function() workspace.SuspiciousItems:Destroy() end) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 07:48 PM |
Err just use your one line thing for now, my code probably has errors, but was just written to show you some aspects of the cloning process.
I would test your 1 line clone in PlayTest in the command bar.
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 07:50 PM |
I tried this:
workspace:WaitForChild'AVeryNerdyDude':clone().Parent = workspace
It just says for the error:
'Attempt to index a nil value'
with no explanation
#code ypcall(function() workspace.SuspiciousItems:Destroy() end) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 07:51 PM |
Then you must not exist, right?
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 07:52 PM |
I am in the game with my character when I run the code (my character is fully loaded and everything)
I am not sure what might be causing this.
#code ypcall(function() workspace.SuspiciousItems:Destroy() end) |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 07:53 PM |
I figured it out!
Turns out I have to enable the Archivable property of the player model before cloning.
#code ypcall(function() workspace.SuspiciousItems:Destroy() end) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 07:54 PM |
Oh gosh, why would that be unchecked XD?
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 08:22 PM |
| It's set to false by default, unfortunately. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 05 Jun 2016 08:22 PM |
Interesting, of just Characters?
|
|
|
| Report Abuse |
|
|
| |
|