|
| 28 Aug 2011 06:48 PM |
Whats wrong with this script?: -------------------------------------------------------- brick = workspace.brick
function onTouch(hit) hum = hit.Parent:findFirstChild("Humanoid") if hum ~= nil then Instance.new('Explosion') Explosion.Parent = brick end
brick.Touched:connect(ontouch) ---------------------------------------------------------- |
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 28 Aug 2011 06:55 PM |
There are a **LOT** of things that're wrong with it.
`
brick = game.Workspace.Brick
brick.Touched:connect(function(hit) plr = game.Players:getPlayerFromCharacter(hit.Parent) if plr then local bewm = Instance.new("Explosion", game.Workspace) bewm.BlastPressure = 1e5 bewm.BlastRadius = 3 bewm.Position = brick.Position wait(1) bewm:Remove() end end)
` |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 28 Aug 2011 08:26 PM |
| YOu have to look more aobut explosion properties. |
|
|
| Report Abuse |
|
|
GoldenUrg
|
  |
| Joined: 23 Aug 2009 |
| Total Posts: 6428 |
|
|
| 28 Aug 2011 10:08 PM |
The main thing that's wrong is brick.Touched:connect(ontouch) should be brick.Touched:connect(onTouch) -- name must match exactly including case
It is not necessary to inline the function or to use a particular form of workspace (Workspace, Game.Workspace, and workspace all work as well as game.Workspace) |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2011 10:14 PM |
StrengthOfExplosion = 1e5 RadiusOfExplosion = 3 >brick = game.Workspace.Brick >brick.Touched:connect(function(hit) >plr = game.Players:GetPlayerFromCharacter(hit.Parent) >if plr then >local ex = Instance.new("Explosion", game.Workspace) >ex.BlastPressure = StrengthOfExplosion >ex.BlastRadius = RadiusOfExplosion >ex.Position = brick.Position >end >end)
|
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 29 Aug 2011 04:04 PM |
| I think he figured it out now. |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2011 07:07 PM |
| Thanks Guys! Especially those eho explained it to me! Though ive given up on an explosion brick because im looking into something bigger (hint: they both have to do with Doctor Who) |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|