Hello, I’m very confused about what is going on and I don’t know how to explain this properly but I’ll try. So I was scrolling through the Developer Hub on this article: Handling Events and I was confused about something. In the script below how do they manage to set the value ofotherParttomyPart.Touched:Wait()?
Simple, :Wait() just yields the code until event fires and returns it’s arguments which in this case Touched event returns the other part that came in contact with myPart.
For the :Connect() one event call the onTouched function with the other part that came in contact with part as the first argument.
When a variable is defined inside of brackets () on the end of a function they are called parameters, it allows for functions to be more useable and accessable. If it wasn’t for parameters .Touched would be useless
Because adding brackets next to function will call them (or in another words, it would run the code inside them) instead of giving the reference to the :Connect() function so event can call the function when it fires.