beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
|
| 04 Nov 2011 07:16 AM |
Can a script detect when it is hit by a explosion? Like for example,
if script.Parent:Touchedbyaexplosion then script.Parent.Remove() |
|
|
| Report Abuse |
|
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
| |
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
|
| 04 Nov 2011 07:23 AM |
if script.Parent.Explosion.Hit then script.Parent.Remove()
Like that? |
|
|
| Report Abuse |
|
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
| |
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
|
| 04 Nov 2011 08:43 AM |
It's an event.
script.Parent.Hit:connect(function (instance, distanceFromBoom) end) |
|
|
| Report Abuse |
|
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
|
| 04 Nov 2011 09:15 AM |
| How do I put it all together in one script? |
|
|
| Report Abuse |
|
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
| |
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
|
| 04 Nov 2011 09:22 AM |
| How do I put it together in a script so it works? I cant make it work because I dont know whats first and last. |
|
|
| Report Abuse |
|
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
|
| 04 Nov 2011 09:23 AM |
| What do you want it to do? |
|
|
| Report Abuse |
|
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
|
| 04 Nov 2011 09:24 AM |
| I want a brick to be deleted if it is touched by a explosion. |
|
|
| Report Abuse |
|
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
| |
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
|
| 04 Nov 2011 09:42 AM |
| script.Parent.Hit:connect(function (hit, dis) hit:remove() end |
|
|
| Report Abuse |
|
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
|
| 04 Nov 2011 09:43 AM |
Oops, I meant script.Parent.Hit:connect(function (hit, dis) hit:remove() end)
DAAAAAAII FLOOOOOODCHEEEEEEEECK! Y U nu dai? |
|
|
| Report Abuse |
|
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
| |
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
|
| 04 Nov 2011 09:45 AM |
| Wait, I need it to be removed by explosions only and the script is supposed to be inside the removed brick. |
|
|
| Report Abuse |
|
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
|
| 04 Nov 2011 09:46 AM |
| Oh, not, you gotta put the script in the explosion. |
|
|
| Report Abuse |
|
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
|
| 04 Nov 2011 09:47 AM |
script.Parent.Hit:connect(function (hit, dis) if hit.Name = "Designation here" then hit:remove() end end
you should be able to choose which bricks are removed by name. |
|
|
| Report Abuse |
|
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
|
| 04 Nov 2011 09:48 AM |
Oops, I meant:
script.Parent.Hit:connect(function (hit, dis) if hit.Name = "Designation here" then hit:remove() end end)
e.e |
|
|
| Report Abuse |
|
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
|
| 04 Nov 2011 09:49 AM |
Instead of
script.Parent.Hit:connect(function (hit, dis) if hit.Name = "Designation here" then hit:remove() end end)
Shouldnt it be
script.Parent.Hit:connect(function (hit, dis) if hit.Type = "Explosion" then script.Parent:remove() end end)
|
|
|
| Report Abuse |
|
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
|
| 04 Nov 2011 09:51 AM |
| Erm, no, the script MUST be in the explosion. :S |
|
|
| Report Abuse |
|
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
|
| 04 Nov 2011 09:51 AM |
It says "Hit is not a valid member of part"
script.Parent.Hit:connect(function (hit, dis) if hit.ClassName == "Explosion" then script.Parent:remove() end end)
|
|
|
| Report Abuse |
|
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
| |
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
|
| 04 Nov 2011 09:51 AM |
| Ok. So with a rocket launcher, how am I supposed to give the explosion a script? |
|
|
| Report Abuse |
|
|
ZizZazZuz
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 2743 |
|
|
| 04 Nov 2011 09:54 AM |
| Find the rocket explosion script and connect the function to the explosion the rocket creates. Put it before it's parented to Workspace. |
|
|
| Report Abuse |
|
|
beeflord
|
  |
| Joined: 06 Jun 2009 |
| Total Posts: 3372 |
|
|
| 04 Nov 2011 09:58 AM |
Ok I found it, how do I clone it into the rocket?
local hitterScript = game.Lightning.theScript --clone script here hitterscript.Parent = Rocket |
|
|
| Report Abuse |
|
|