generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Cloning characters?

Previous Thread :: Next Thread 
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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 is not online. 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
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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 is not online. 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 is not online. 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 is not online. 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
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
05 Jun 2016 07:47 PM
"Attempt to index global 'charClone' (a nil value)"


#code ypcall(function() workspace.SuspiciousItems:Destroy() end)
Report Abuse
Soybeen is not online. 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
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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 is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
05 Jun 2016 07:51 PM
Then you must not exist, right?


Report Abuse
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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 is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
05 Jun 2016 07:54 PM
Oh gosh, why would that be unchecked XD?


Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
05 Jun 2016 08:22 PM
It's set to false by default, unfortunately.
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
05 Jun 2016 08:22 PM
Interesting, of just Characters?


Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
05 Jun 2016 08:24 PM
Yep.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image