generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Whats Wrong with my Code!

Previous Thread :: Next Thread 
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
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
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
05 Apr 2013 08:40 PM
Bump I just want it to create an Explosion on hit.Which is basicly ontouched
Report Abuse
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
05 Apr 2013 08:41 PM
basically*
Report Abuse
anthony46804 is not online. anthony46804
Joined: 03 Dec 2008
Total Posts: 590
05 Apr 2013 08:42 PM
Title fix
Report Abuse
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
05 Apr 2013 08:42 PM
Sadly I cannot do something as simple as this.
Report Abuse
veerstrong is not online. veerstrong
Joined: 23 Jun 2009
Total Posts: 2450
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
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
05 Apr 2013 08:43 PM
Fix what?
Report Abuse
UnBuild is not online. 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
anthony46804 is not online. anthony46804
Joined: 03 Dec 2008
Total Posts: 590
05 Apr 2013 08:43 PM
"Fix what?"


*facepalm*
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
05 Apr 2013 08:43 PM
Whoa Veer Thank you so much you saved my but!
Report Abuse
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
05 Apr 2013 08:44 PM
Thanks guys
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
05 Apr 2013 08:44 PM
Remember you do NEED to set the explosion's position, or it won't appear.

(╯°□°)> KMXD
Report Abuse
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
05 Apr 2013 08:49 PM
Hmmm I'm trying it now
Report Abuse
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
05 Apr 2013 08:52 PM
...
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
05 Apr 2013 08:56 PM
HOw
Report Abuse
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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 is not online. 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 is not online. 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
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
05 Apr 2013 09:03 PM
Awwww its not working
Do it have to be a local script in my sword?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image