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: What's the stuff in a function's parentheses called?

Previous Thread :: Next Thread 
ash877 is not online. 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 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
22 Jan 2014 09:47 PM
paramter.
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
22 Jan 2014 09:50 PM
thanks.
Report Abuse
domorox17 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
22 Jan 2014 09:51 PM
Not a problem my friend.
Report Abuse
Goulstem is not online. 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 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
22 Jan 2014 09:52 PM
@goul it is called a parameter.
Report Abuse
Goulstem is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Jan 2014 10:01 PM
Touched event, not onTouched event.
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