The final line,
script.Parent.Touched:connect(onTouch)
is a connection.
You are calling the function connect (indicated by a name + parenthesis: connect()).
When connect is called, it tells ROBLOX to remember the function you gave it (you gave it onTouch).
Then, when something touches the part, ROBLOX will internally then call what you gave the connect method (so it calls onTouch)
The line
function onTouch(part)
means nothing special on its own. You just define a function with one parameter, and set the names of them to what you want.
You could also say
funcToConnect = onTouch;
script.Parent.Touched:connect(funcToConnect);
and it would behave the same as the original.
4 comments
so "onTouch(part)" means when a part touches it?
No, that's just what the function is named. You could name it ILIKEPOOP if you wanted. Line 9 is what makes the function fire every time something touches the brick.
so the function is "ontouch" but wat is in the parentheses is naming the function?
What do you mean by "naming" the function? The parentheses contains 1 parameter. If you connect the function to the touched event, that parameter automatically becomes the part that just touched the brick.