✓ Accepted answer
We assume that script.Parent is a BasePart, thus it has the Touched event. Events of instances are RBXScriptSignal instances. This instance is in charge of connecting functions to events. One of the functions of the RBXScriptSignal is :Connect(function func). This will take a function as an argument and guarantee to call it when the event is omitted.
function(brick) is the beginning of the definition of the function we would like to call when the Touched event fires. We have a paramter brick in the function definition because the Touched event gives us the other part that touched the original part.
We can not gaurentee that the brick that touched our script.Parent is a Character. So if we did brick.Parent.Humanoid the script would error. Using :FindFirstChild(string name) lets us check to see if something is there without erroring. If something is there we get that thing, if it is not there we get nil.
We use brick.Parent to locate the Character. Players have Characters that are models that contain up to 15 different parts that are connected together. We use brick.Parent to see if we have a Character in our case.
1 comment
Thank you so much, this was so nicely in detailed explained