|
| 05 Apr 2013 08:39 PM |
So I was editing one of my swords.And I said it would be nice for me to make a FX effect.So I wanted to do an explosion on hit so this what I typed.
function onTouched(part) instance.new(Explosion)
Whats wrong with it please help me? |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2013 08:40 PM |
| Bump I just want it to create an Explosion on hit.Which is basicly ontouched |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 05 Apr 2013 08:42 PM |
| Sadly I cannot do something as simple as this. |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2013 08:43 PM |
in a block
script.Parent.Touched:connect(function(p) if p.Parent:FindFirstChild("Humanoid") then m = Instance.new("Explosion", script.Parent) m.BlastRadius = 30 --u can add other properties end end)
~One must risk everything to find the truth. Even if the truth isn't what you want it to be, it is better than living a lie.~ |
|
|
| Report Abuse |
|
|
| |
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 05 Apr 2013 08:43 PM |
For one you need to parent it.
Instance.new("Part", Workspace) |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Apr 2013 08:43 PM |
For your function, you need an end, and a connection line. For your explosion, you need to capitilize the "i" in "Instance". You would also need to set the parent and position of the explosion.
function onTouched(part) Instance.new(Explosion, part).Position = part.Parent end
SWORD.Touched:connect(onTouched)
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2013 08:43 PM |
| Whoa Veer Thank you so much you saved my but! |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Apr 2013 08:44 PM |
Remember you do NEED to set the explosion's position, or it won't appear.
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 05 Apr 2013 08:54 PM |
function onTouched(part) Instance.new(Explosion, part).Position = part.Parent.Position end -- Knight you forgot "position" after part.Parent
SWORD.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2013 08:55 PM |
Ah, yes. Though it would be better to use veer's code, and add the position.
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Apr 2013 08:59 PM |
Will this work? script.Parent.Touched:connect(function(p) if p.Parent:FindFirstChild("Humanoid") then m = Instance.new("Explosion", script.Parent) m.BlastRadius = 30 m.Position = part.Parent end end) |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2013 09:00 PM |
m.Position = p.Parent.Position --Because "p" in his function is the part that was touched
(╯°□°)> KMXD
|
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 05 Apr 2013 09:01 PM |
Position isn't a property.
script.Parent.Touched:connect(function(p) if p.Parent:FindFirstChild("Humanoid") then m = Instance.new("Explosion", script.Parent) m.BlastRadius = 30 m.Parent = script.Parent end end)
That will set the Parent of m as the same one as the script.
If you want it somewhere else just use
m.Parent = game.Workspace.[InsertPartNameHere]
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 05 Apr 2013 09:02 PM |
Wait position is a property?
My bad. Don't work with explosions too much.
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2013 09:03 PM |
Awwww its not working Do it have to be a local script in my sword? |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2013 09:04 PM |
@FIRE
The parent is already set, and Position is an important property. You're only confusing him.
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 05 Apr 2013 09:04 PM |
Ok then, don't listen to me, I don't know what I'm talking about!
⊂=-҉Ξ҉-=⊃ Verb conjugator, plus herb inhalator ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|