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 » Scripting Helpers
Home Search
 

Re: How do i clone myself through a script?

Previous Thread :: Next Thread 
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 01:41 PM
I tried :clone() and making myself archivable = false but it's not working.
P.S: im bad with :getChildren() method.

i want it to clone everything including hats, so i ican make it follow other players
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
30 Jan 2013 01:42 PM
Easy.

game.Players.robotmega.Character:Clone().Parent = workspace
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 01:47 PM
Did u even read?
I said i already tried that
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
30 Jan 2013 01:48 PM
Above, he did but your just wrong.Either:

1.You forgot to put the writings in a script or its still in notepad

2nd.Other scripts breaks it.

3rd.Make sure ur in the 0,-10,0 position.
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 01:59 PM
Not really.


I did this:

game.Workspace.robotmega.Archivable = false
game.Players.robotmega.Archivable = false
a=game.Players.robotmega.Character:clone()
a.Parent = game.Workspace
a.Position = game.Workspace.robotmega.Torso.Position
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
30 Jan 2013 02:03 PM
A note to Fedora: Who uses notepad these days? It's entirely useless. Either use Notepad++ or SciTE. Both of them are free, I belive.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
30 Jan 2013 02:03 PM
Try:

a=game.Players.robotmega.Character:clone()
a.Parent = game.Workspace
a.Position = game.Workspace.robotmega.Torso.Position
game.Players.robotmega.Archivable = false


You deleted ur player and character before u cloned it, no u no clone no script no dreams.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
30 Jan 2013 02:04 PM
Well dig, i wont bother install something jjust to write something.
Report Abuse
As8D is not online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
30 Jan 2013 02:07 PM
>>>>
Scan through your character, and clone everything (you want... scripts too?)


You cannot clone your character, but you can clone it's descendants. There you've got a way.

( Did this years ago, cannot remember why though D: )

- As, brainwashed by opening themes.
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 02:21 PM
@As

We all know we need to use :getChildren in a loop.

But i don't know how to do that
Report Abuse
Combrad is not online. Combrad
Joined: 18 Jul 2009
Total Posts: 11025
30 Jan 2013 02:26 PM
function Clone(Char)
local Parts = {Char.Humanoid,Char.Torso,Char["Left Arm"],Char["Right Arm"],Char["Left Leg"],Char["Right Leg"],Char.Head}
local Other = Char:GetChildren()
local M = Instance.new("Model")
M.Name = Char.Name
for i = 1,#Parts do
Parts[i]:Clone().Parent = M
end
for i = 1,#Other do
if Other[i]:IsA'Shirt' or Other[i]:IsA'Pants' or Other[i]:IsA'ShirtGraphic' or Other[i]:IsA'Hat' or Other[i]:IsA'CharacterMesh' then
Other[i]:Clone().Parent = M
end
end
M.Parent = game.Workspace
M:MakeJoints()
return M
end

local NewChar = Clone(game.Workspace.Combrad)
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
30 Jan 2013 02:35 PM
LOL

chars = {"a", "b", "c", "d", "e", "f", "g", "h" , "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}

player = game.Players.crouton04.Character

for i = 1,#chars do

for _,v in pairs(plr:GetChildren()) do
if string.find(v.Name, chars[i]) then
v:Clone()
--blah
end
end
end

Was that your mom? Tell her she needs to exercise a little more, those legs had a little flab.
Report Abuse
As8D is not online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
30 Jan 2013 02:43 PM
Hm, Combrad. What if an arm is lost in lava or something? :/ I'd prefer... ok, lemme just imaginate a code (Don't think about if it's complicated, just run the function and pow!):

---------------------------------------------------------------------------------------

function clone(model) if not pcall(function() return model:IsA("Instance") end) end
local returnValue = Instance.new("Model") returnValue.Name = model.Name
local function scanModel(parent, returnParent)
for _,c in pairs(parent:GetChildren()) do
local newpart = c:clone() newpart.Parent = returnParent
if #c:GetChildren() > 0 then scanModel(c, newpart) end
end end scanModel(model, returnValue) return returnValue end

---------------------------------------------------------------------------------------

Example:
clone(workspace.Player1).Parent = workspace

---------------------------------------------------------------------------------------

(Note: I haven't tested the function, and I've just typed it in this comment, so if there's any errors, PM me)

- As
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 02:49 PM
@Combrad
it works, but theres some errors.

It makes 2 clones.
First one dies, second one is inside my body and i move VERY slow
Report Abuse
YellowBrick1 is not online. YellowBrick1
Joined: 06 May 2009
Total Posts: 865
30 Jan 2013 02:52 PM
Did you mean to set Archivable to true, not false?
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 02:57 PM
please reply..
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 03:15 PM
bump
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 03:17 PM
@combrad

and btw the script just works 1 time
Report Abuse
Combrad is not online. Combrad
Joined: 18 Jul 2009
Total Posts: 11025
30 Jan 2013 03:26 PM
function Clone(Char)
local P = Char:GetChildren()
local M = Instance.new("Model")
M.Name = Char.Name
for i = 1,#P do
if P[i]:IsA'Part' or P[i]:IsA'Shirt' or P[i]:IsA'Pants' or P[i]:IsA'Hat' or P[i]:IsA'ShirtGraphic' or P[i]:IsA'CharacterMesh' or P[i]:IsA'Humanoid' then
P[i]:Clone().Parent = M
end
end
M.Parent = game.Workspace
M:MakeJoints()
M:MoveTo(M.Torso.Position)
end

Try that one, may work better.
Report Abuse
Parthax is not online. Parthax
Joined: 27 Apr 2011
Total Posts: 6941
30 Jan 2013 03:32 PM
robot, don't use Position for moving characters. In that line, replace Position with CFrame. CFrame will move all the welds, therefore moving the whole character instead of just their torso.
Report Abuse
Combrad is not online. Combrad
Joined: 18 Jul 2009
Total Posts: 11025
30 Jan 2013 03:34 PM
@Parthax, is that is aimed at my script, :MoveTo will do that just fine. I felt CFrame was not needed.
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 04:38 PM
1 error more.

His body parts fall(except head and torso, and hats)
Report Abuse
Combrad is not online. Combrad
Joined: 18 Jul 2009
Total Posts: 11025
30 Jan 2013 04:41 PM
Oh, you need to Instance a Humanoid rather than clone it.
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 04:42 PM
ok
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
30 Jan 2013 04:45 PM
I got this, it works, but after i do the second clone(with this script) his body parts breaks again.

function Clone(Char)
local P = Char:GetChildren()
local M = Instance.new("Model")
M.Name = Char.Name
for i = 1,#P do
if P[i]:IsA'Part' or P[i]:IsA'Shirt' or P[i]:IsA'Pants' or P[i]:IsA'Hat' or P[i]:IsA'ShirtGraphic' or P[i]:IsA'CharacterMesh' or P[i]:IsA'Humanoid' then
P[i]:Clone().Parent = M
end
end
M.Humanoid:remove()
hum = Instance.new("Humanoid")
hum.Parent = M
hum.MaxHealth = 5
hum.Health = 5
hum.WalkSpeed = 16
M.Parent = game.Workspace
M:MakeJoints()
M:MoveTo(M.Torso.Position)
M.Head.BillboardGui:remove()
end

local NewChar = Clone(game.Workspace.robotmega)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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