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: :Clone() Nil?

Previous Thread :: Next Thread 
GuestCapone is not online. GuestCapone
Joined: 19 Oct 2012
Total Posts: 1928
09 Aug 2013 09:33 PM
I'm missing what?
--30 something lines down.
function SwitchCharacter()
local tank = Vehicles[SelectedVehicle]:GetChildren()
tank:clone() --ERROR.
tank.Parent = plr.Character
tank:MoveTo(game:GetService("Workspace"):FindFirstChild("BasePads")[plr:findFirstChild("BaseID").Value].Position)
tank:MakeJoints()
tank.Main_Script.Disabled = false
tank:GetChildren().Parent = plr.Character
end

21:31:49.691 - Players.Player2.PlayerGui.LoadOutScreen.LocalScript:12: attempt to call method 'clone' (a nil value)
21:31:49.694 - Script "Players.Player2.PlayerGui.LoadOutScreen.LocalScript", Line 12 - global SwitchCharacter
21:31:49.695 - Script "Players.Player2.PlayerGui.LoadOutScreen.LocalScript", Line 33
21:31:49.695 - stack end
21:31:49.695 - Disconnected event because of exception
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
09 Aug 2013 09:35 PM
for i,v in pairs(tank) do
v:clone()
end

You have to have a for loop to clone multiple items. I think you mean tank = Vehicles[SelectedVehicle].
That's all you should need. Then it will clone perfectly.

Got a problem with me? Take it up with my butt because it's the only one that gives a crap.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
09 Aug 2013 09:36 PM
You cannot clone a table that is returned by GetChildren.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
09 Aug 2013 09:36 PM
Late post. >_<
Too busy looking at something on the Wiki.

Do what Ceaseless did.
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
09 Aug 2013 09:37 PM
function SwitchCharacter()
local tankParts = Vehicles[SelectedVehicle]:GetChildren()
local newTank = Instance.new("Model")
for Index, Child in pairs(tankParts) do
Child:clone().Parent = newTank
end
newTank.Parent = plr.Character
newTank:MoveTo(Workspace.BasePads.[plr.BaseID.Value].Position)
newTank:MakeJoints()
newTank.Main_Script.Disabled = false
newTank.Parent = plr.Character
end
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
09 Aug 2013 09:37 PM
:(
don't post before me
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
09 Aug 2013 09:37 PM
@AFF, I beat you for once! :D

Got a problem with me? Take it up with my butt because it's the only one that gives a crap.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
09 Aug 2013 09:38 PM
@Cease

This:
_______________________________________

Iterations

Joined: 22 Jul 2013
Total Posts: 297
Skilled Scripters

Re: :Clone() Nil?
Posted: 08-09-2013 07:37 PM
:(
don't post before me
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
09 Aug 2013 09:39 PM
@AFF, what about it..?

Got a problem with me? Take it up with my butt because it's the only one that gives a crap.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
09 Aug 2013 09:40 PM
":(
don't post before me"
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
09 Aug 2013 09:40 PM
Why not? You always posted before me.. You made me cry once, D:.

Got a problem with me? Take it up with my butt because it's the only one that gives a crap.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
09 Aug 2013 09:41 PM
Yeah, well.
I was on Wiki. It wasn't fair. QQ
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
09 Aug 2013 09:41 PM
"You made me cry once"

woah man
you can post before me
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
09 Aug 2013 09:43 PM
@AFF, umad?

Got a problem with me? Take it up with my butt because it's the only one that gives a crap.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
09 Aug 2013 09:43 PM
@Cease: yaimad
comeatmebro
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
09 Aug 2013 09:45 PM
I will com and eat you bro! What do you taste like? Milk chocolate, dark chocolate, or vanilla chocolate?

Got a problem with me? Take it up with my butt because it's the only one that gives a crap.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
09 Aug 2013 09:45 PM
I taste like chikin.
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
09 Aug 2013 10:07 PM
[Content Eated]
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
09 Aug 2013 10:12 PM
:D

Got a problem with me? Take it up with my butt because it's the only one that gives a crap.
Report Abuse
GuestCapone is not online. GuestCapone
Joined: 19 Oct 2012
Total Posts: 1928
10 Aug 2013 12:25 PM
Thanks I'll keep this in mind.
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
10 Aug 2013 12:33 PM
function SwitchCharacter()
local tank = Vehicles[SelectedVehicle]:GetChildren()
tank:Clone() --ERROR.
tank.Parent = plr.Character
tank:MoveTo(game:GetService("Workspace"):FindFirstChild("BasePads")[plr:findFirstChild("BaseID").Value].Position)
tank:MakeJoints()
tank.Main_Script.Disabled = false
tank:GetChildren().Parent = plr.Character
end


Guest, you forgot to capitalize 'Clone()'.
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