Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Are arguments already defined?

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)

1 comment

0

1 answer

✓ Accepted answer

An overview

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.


Arguments

otherPart - The part which touches the object


Struggling?

My answer may of not helped you enough, but here is a link to the wiki if you are struggling.


Thanks for reading!

Thanks for reading my answer. If it helped, make sure to upvote it or set it as the correct answer!

2 comments

0

Wow, thanks. So hit is just a variable. This really cleared things up for me!

0

You're welcome.

This discussion is preserved as it was. New answers, comments, and votes are closed.