|
| 19 Mar 2014 12:29 PM |
Hi I'm making a game that involves a script that makes a thing happen if a brick touches an explosion. I tried using a Touch detector but it didn't register if i shot a rocket launcher at the brick.
Any help? |
|
|
| Report Abuse |
|
|
| |
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 19 Mar 2014 12:32 PM |
| Look up the Hit event on the wiki |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2014 12:36 PM |
| Yeah but i need the brick to react to any explosion not a script-made explosion |
|
|
| Report Abuse |
|
|
| |
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 19 Mar 2014 12:40 PM |
Hit event Check if the part that hit the explosion is the part you wanna destroy Destroy it.
Also, a strong explosion will separate bricks that are unanchored and joined together with glue without any script. |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2014 12:43 PM |
| Okay so how do i make it so that if a explosion hits a part the part dissappears? |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2014 12:47 PM |
Ok so here is what i have so far:
function onTouched(hit) local Prize = game.Lighting.BlowBuck local HitName = hit.Name local HitLocation = hit.Position local P = script.Parent if HitName == ("Explosion") then wait(0.5) P.BrickColor = BrickColor3.New ("Black") P.Transparancy = 0.5 wait(0.1) P.Transparancy = 0.6 wait(0.1) P.Transparancy = 0.8 wait(0.1) P.Transparancy = 1 wait(0.1) Prize:Clone(game.Workspace) Prize.Position = HitLocation P:Destroy() else return nil end end
script.Parent.Touched:connect(onTouched)
I want this function to be called when an explosion hits it. But checking if it is called "Explosion" Doesn't do anything. Any help? |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2014 12:50 PM |
The hit event won't work. The hit event runs when a part hits another part. I suggest you determine the range an explosion has and use magnitude to destroy all parts within its range. I'll get you started.
game.Workspace.ChildAdded:connect(function(thing) if thing.ClassName == "Explosion" then radius = thing.BlastRadius
From then on, it's up to you. I'm too lazy to do some magnitude stuff.
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2014 12:54 PM |
Wait... magnitude wha?
Oh whatever. I will just do it the booby way and make it so that a explosion spawns a invisible brick that is as big as the explosion and have it react to THAT touching it :3 |
|
|
| Report Abuse |
|
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 19 Mar 2014 01:34 PM |
"The hit event runs when a part hits another part"
Don't you mean touched? And why not Hit event. |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 19 Mar 2014 01:59 PM |
ur brick cant hit a frkn exsplosion
use .magnitude to check everything around and see if .ClassName or :IsA('Explosion') kk |
|
|
| Report Abuse |
|
|
Vulcain
|
  |
| Joined: 18 Oct 2010 |
| Total Posts: 42 |
|
|
| 19 Mar 2014 02:01 PM |
They mean the Hit event for an Explosion class.
local Explosion = Instance.new("Explosion",workspace)
Explosion.Hit:connect(function(part) if (part.Name=="PART NAME") then part:Destroy() end end) |
|
|
| Report Abuse |
|
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 19 Mar 2014 02:05 PM |
A brick can't touch a frickin explosion An explosion can hit a brick |
|
|
| Report Abuse |
|
|