Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Can someone help me on understanding parameters in functions?

Asked by 4 years ago
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.

0
hard to explain, but I kinda just make myself see it as a variable 0msh 333 — 4y
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 GoldAngelInDisguise 297 — 4y

1 answer

Log in to vote
0
Answered by
Gojinhan 353 Moderation Voter
4 years ago

'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)

Ad

Answer this question