for an exampe
1 | local function hi( [ somthing here ] ) |
2 | print ( "What does the bracket means D: I can't find my answer on the internet." ) |
3 | end |
The bracket for function() allows arguments to added in it. Example:
1 | function (arg 1 ) |
2 | print (arg 1 ) |
3 | end |
4 | arg 1 ( "Hello World!" ) |
The function would print Hello World! This use can allow developers to quickly run codes without copy and pasting it. Also this is very important for modules scripts too.
======After editing===========
A more complex situation for this would be a script requiring a module script to summon a part Exmaple:
Module Script:
1 | local module = { } |
2 | function module:SpawnPart(position, partcolor) |
3 | local part = Instance.new( "Part" ) |
4 | part.Position = position |
5 | part.Color 3 = partcolor |
6 | print ( "Added part!" ) |
7 | end |
8 | return module |
Script:
1 | local module = require(moduleScript) |
2 | module:SpawnPart(Vector 3. new( 0 , 0 , 0 ), Color 3. fromRGB( 0 , 50 , 100 )) |
I would suggest searching up what arguments and parameters are because they play a major role in scripting. But I'll try to do my best to explain it.
01 | --// Parameters are values inside of the brackets when you create the function |
02 |
03 | local function printingfunction(x) |
04 | print (x) |
05 | end |
06 |
07 | --// Arguments are the syntax used when you call your function |
08 |
09 | printingfunction( "Hello World!" ) |
10 |
11 | --> Console would print Hello World! |
This is a simple example of arguments and parameters. You can create more complex functions with multiple parameters and arguments
Sources: http://wiki.roblox.com/index.php?title=Arguments_and_parameters