|
| 15 May 2014 01:06 AM |
Is it possible to clone a script into whatever that touched it ? Here's the script that I wrote..
LavaBomb = script.Parent
function onTouched(hit) game.Lighting:findFirstChild(MeltScript):clone().Parent = hit connection:disconnect() end
connection = LavaBomb.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 15 May 2014 01:13 AM |
p=script.Parent
d=0 p.Touched:connect(function(hit) local c=game.Lighting:FindFirstChild("MeltScript"):Clone() if d==0 then d=1 c.Parent=hit end wait(1/2) d=0 end)
|
|
|
| Report Abuse |
|
|
|
| 15 May 2014 01:16 AM |
-BUMP-
--Recent Script Change--
LavaBomb = script.Parent
function onTouched(hit) game.Lighting.MeltScript:clone().Parent = hit connection:disconnect() end
connection = LavaBomb.Touched:connect(onTouched)
--------------
This one works as intended, BUT it only works for the one part, I'm guessing it's because all the parts within the blast radius is now generally named ' hit ', so game is confused therefore it randomly picked one and clone the script inside that one :/
I want it to clone the MeltScript inside each and every part that touched this brick . |
|
|
| Report Abuse |
|
|
|
| 15 May 2014 01:18 AM |
| @Jimmy I used your script and it works like the script I changed above, it only affects one brick |
|
|
| Report Abuse |
|
|
|
| 15 May 2014 01:20 AM |
A simpler explanation of how I want it to work,
------------------------
PartB is a 10,10,10 invisible sphere .
Everything that touches PartB will have a MeltScript cloned inside it . So when I drive a car through PartB, all parts that touched it will have the script cloned inside them .
-----------------------
What's going on now, Game only chose one part among the lot that touched PartB, and cloned the script particularly inside that one only . |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
| |
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 15 May 2014 01:23 AM |
| Oh also the reason it only does it to one part is because you disconnect or, cancel, your touched event. |
|
|
| Report Abuse |
|
|
|
| 15 May 2014 01:34 AM |
OH NO WONDER XD
Forgot about the disconnect() xD
Thanks mate it works now :D |
|
|
| Report Abuse |
|
|