ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 22 Jan 2014 09:47 PM |
| It might seem like a stoopid thing to ask, but I have no idea what it's called. Is it a variable; can I declare it to be anything? |
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
| |
|
ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
| |
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
| |
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 22 Jan 2014 09:52 PM |
Something like;
game.Workspace.Derp.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then hit.Parent:BreakJoints() end end)
The '(hit)' is assigning a variable to the onTouched event, the variable is the hitter AKA thing that hit the block soo.. 'if hit.Parent(checking the hit):FindFirstChild("Humanoid") ~= nil(checking if the hitter is a humanoid, and if the humanoid is nil) then hit.Parent:BreakJoints()(Telling to break all the joints of the hitter if the above line is validated) end end)(ending the if statement and the function) |
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 22 Jan 2014 09:52 PM |
| @goul it is called a parameter. |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 22 Jan 2014 09:56 PM |
| Lol well I explained what it does, even if I misinformed on what it was called. |
|
|
| Report Abuse |
|
|
domorox17
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 1710 |
|
|
| 22 Jan 2014 09:57 PM |
| sorta. You described onTouched as an event instead of a function name :P |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 22 Jan 2014 09:58 PM |
| That's because it is an event, it can be called anything in a function :) |
|
|
| Report Abuse |
|
|
Akrus96
|
  |
| Joined: 08 Dec 2008 |
| Total Posts: 34 |
|
|
| 22 Jan 2014 09:59 PM |
It's called a parameter. You use it as a variable in the function. Whatever you put in the parenthesis when you call the function will be set as that variable.
function mahNewFunction(param)
Here, "param" is the name of the parameter. You can call it whatever you want, and you can have more than one, so long as you separate them with commas, like so:
function mahNewFunction(param1, param2, param3)
Where param1, 2 and 3 are your parameters.
You use parameters in your function, so that you can set stuff when you call it, as seen here:
function mahNewFunction(param) print(param) end
And so, we call the function with "Hi mom!" as an example.
mahNewFunction("Hi mom!")
Which would result in it executing "print" to "Hi mom!", and in your output, it would show up as:
>Hi mom!
And so, thar ya go. If it seems too complicated, tell me, and I'll try to make a better example. If you need anything more explained, message me. |
|
|
| Report Abuse |
|
|
Akrus96
|
  |
| Joined: 08 Dec 2008 |
| Total Posts: 34 |
|
|
| 22 Jan 2014 10:00 PM |
| Lul I spent a little long with my reply and someone explained it before me :P |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 22 Jan 2014 10:01 PM |
| Touched event, not onTouched event. |
|
|
| Report Abuse |
|
|