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.
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.
'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.
2 comments
hard to explain, but I kinda just make myself see it as a variable
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