So with functions, the name can be whatever you want it to be. But is that the same with arguments? For example, how does the script know that hit mean's hit. Since there is nothing to tell it what it is. Even if I change Hit to anything else it still works. My question is, are arguments already defined, if so where can I find a list of them. Thanks for clearing this up for me!
function touch(hit) hit.Anchored = true -- FIXES YOUR LEG IN PLACE >8D end script.Parent.Touched:connect(touch)
When you connect a Signal
to a function
using :connect()
, you are telling the signal to fire the function, whenever it is fired. It also passes arguments. If you change hit, you are just changing the name of the variable to use. The signal passes the object hit as the first argument, so the first variable defined in your function will be that.
otherPart
- The part which touches the object
My answer may of not helped you enough, but here is a link to the wiki if you are struggling.
Thanks for reading my answer. If it helped, make sure to upvote it or set it as the correct answer!