ekideki
|
  |
| Joined: 27 Nov 2010 |
| Total Posts: 88 |
|
|
| 28 Apr 2013 07:01 AM |
| I've recently started to learn how to script, and just can't understand how to make a script to clone a part when an other part touches it. Any help, please? |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 28 Apr 2013 07:11 AM |
script.Parent.Touched:connect(function(hit) if hit.Parent:IsA("Part") then script.Parent:Clone().Parent = Workspace end end) |
|
|
| Report Abuse |
|
|
ekideki
|
  |
| Joined: 27 Nov 2010 |
| Total Posts: 88 |
|
| |
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
| |
|
ekideki
|
  |
| Joined: 27 Nov 2010 |
| Total Posts: 88 |
|
|
| 28 Apr 2013 07:48 AM |
| I did, I'm not that stupid. :P |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2013 07:52 AM |
script.Parent.Touched:connect(function(hit) if hit.Parent:IsA("Part") then script.Parent:Clone().Parent = game.Workspace end end) --------------------------------------------------------
or try this one
-------------------------------------------------------- Workspace = game.Workspace script.Parent.Touched:connect(function(hit) if hit.Parent:IsA("Part") then script.Parent:Clone().Parent = Workspace end end) --------------------------------------------------------- He didn't define workspace although.. if you were to shortcut it, i'd be 'workspace' not 'Workspace' so
--------------------------------------------------------- script.Parent.Touched:connect(function(hit) if hit.Parent:IsA("Part") then script.Parent:Clone().Parent = workspace end end)
---------------------------------------------------------- enjoy :) |
|
|
| Report Abuse |
|
|
ekideki
|
  |
| Joined: 27 Nov 2010 |
| Total Posts: 88 |
|
| |
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 28 Apr 2013 11:39 PM |
| Why the heck are you guys check if what hit it has a parent that is a part? |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 28 Apr 2013 11:41 PM |
Also @Ban Workspace or workspace both work, same with game and Game (If you used Game.Workspace it would have to be Workspace not workspace though) |
|
|
| Report Abuse |
|
|
|
| 29 Apr 2013 02:19 PM |
@Unbuild It never works like that for me, every time i've tried doing.. workspace never works, just no output, and no effect.. maybe it's a client glitch.. -.- Might look into this deeper hmm... |
|
|
| Report Abuse |
|
|
pauljkl
|
  |
| Joined: 23 Oct 2008 |
| Total Posts: 9364 |
|
|
| 29 Apr 2013 02:58 PM |
Workspace and workspace are global variables.
script.Parent.Touched:connect(function(hit) if hit:IsA("BasePart") then script.Parent:Clone().Parent = workspace end end) |
|
|
| Report Abuse |
|
|
ekideki
|
  |
| Joined: 27 Nov 2010 |
| Total Posts: 88 |
|
|
| 30 Apr 2013 07:04 AM |
| Thanks paul, that's the only cloning script working for me so far. :P |
|
|
| Report Abuse |
|
|
|
| 01 May 2013 10:25 AM |
| All my ones work, and they're laid out how I put them -.- |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 01 May 2013 11:41 AM |
No yours doesn't work Yours will check if the part parent is a part. |
|
|
| Report Abuse |
|
|