KodakKid3
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 2860 |
|
|
| 05 Sep 2013 05:32 PM |
So, I wrote a little script to cause a fire to appear inside a brick when you touch it. I want to make it so that when you touch it, the fire appears inside your torso. Here's the script:
function onFire(part) local fire = Instance.new("Fire",script.Parent) fire.Position = script.Parent.Position end
script.Parent.Touched:connect(onFire)
How would I do that? I'ma novice scripter, and haven't yet learned. |
|
|
| Report Abuse |
|
|
|
| 05 Sep 2013 05:34 PM |
function spread(hit) if hit.Parent.Humanoid then local f=Instance.new("Fire",hit.Parent.Torso) end script.Parent.Touched:connect(spread)
you would put that in the brick |
|
|
| Report Abuse |
|
|
KodakKid3
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 2860 |
|
|
| 05 Sep 2013 05:48 PM |
| Are spread and hit a function? How do they work? |
|
|
| Report Abuse |
|
|
Wolves25
|
  |
| Joined: 24 Feb 2009 |
| Total Posts: 208 |
|
|
| 05 Sep 2013 06:08 PM |
A function is anything you want it to be. It can have any name you want. So say we create a function named fire.
function fire(hit)
In the parentheses is your argument. So in the case of a touched script, the argument is what is touching the brick.
so then you'd type out your script and then end it with this
script.Parent.Touched:connect(fire)
What that means is that you are calling the function fire when the brick is touched. Hope this helped! |
|
|
| Report Abuse |
|
|
KodakKid3
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 2860 |
|
|
| 05 Sep 2013 06:11 PM |
| Wolves, thanks, but I know that stuff. What I don't know are what hit and spread are. Are they functions, or arguments, or what? And what do they do? |
|
|
| Report Abuse |
|
|
Wolves25
|
  |
| Joined: 24 Feb 2009 |
| Total Posts: 208 |
|
|
| 05 Sep 2013 06:15 PM |
| Spread is the name of the function. And hit is the argument. What that means is, hit is the object that touches the brick. So it'd be the player's body part that touched the brick. Think of hit as a tag for the thing that touches the brick. So let's say that the players torso touches the brick. Hit would represent game.Workspace.PlayerName.Torso |
|
|
| Report Abuse |
|
|
KodakKid3
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 2860 |
|
|
| 06 Sep 2013 08:00 PM |
The script still just adds fire to the brick, not player torso. Here it is, with what you guys made:
function onFire(part) local fire = Instance.new("Fire",script.Parent) fire.Position = script.Parent.Position end
script.Parent.Touched:connect(onFire)
function spread(hit) if hit.Parent.Humanoid then local f=Instance.new("Fire",hit.Parent.Torso) end script.Parent.Touched:connect(spread) end |
|
|
| Report Abuse |
|
|
KodakKid3
|
  |
| Joined: 25 Dec 2008 |
| Total Posts: 2860 |
|
| |
|