I was just wondering if this function can be converted into an anonymouse function, is it possible? I'm thinking no, but I could be wrong.
function onKeyPress(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then print("R was pressed") end end game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.R)
If you don't know what an anonymous function is, it looks something like this:
game.workspace.Part.Changed:Connect(function() print ("A-non-moose") end)
Yes, it can.
game.ContextActionService:BindAction("keyPress", function(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then print("R was pressed") end end, false, Enum.KeyCode.R)