I have a LocalScript in a ClickDetector which is in a part. In the LocalScript I have a function;
script.Parent.MouseClick:Connect(function() end
If i understand correct, the word inside the brackets after function is a variable. I don't have a word there now but if I would have, what does it mean?
MouseClick is an event that fires when a player clicks on the parent Part of the ClickDetector. It provides the player that clicked it as a parameter.
In form it would look like this:
local clickDetector = script.Parent --Include the parameter function onClicked(PlayerThatClicked) print(PlayerThatClicked.Name) --print's name of the player that clicked it. end --Connects to the function. Same as your code too clickDetector.MouseClick:Connect(onClicked)
Not all events have a parameter that do the same thing. You could check by using the API reference in RobloxDev site.
All parameters, like a variable, can use any name inside the parenthesis.