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

Can someone help me on understanding parameters in functions?

UserInputService.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.X then
		local bomb = Instance.new("Explosion", Char.Exo)
	end
end)

I just want to understand what is that "Input" in parenthesis for.

2 comments

0

hard to explain, but I kinda just make myself see it as a variable

0

https://developer.roblox.com/en-us/articles/Function look at "Function Parameters", like ivorfy said they are similiar to variables in the sense that they hold some value and you can name them almost anything you want

1 answer

'Input' in this case, represents the input object, e.g keyboard key x, controller button y, anything that can be properly detected.

this parameter is used to check if an input object is equal to something and then can allow you to execute something. (just like in ur code)

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