Hi, This question is something I have been wondering for a long time, and I need someone to answer this question.
I put this code in a local script, that was in starter player scripts.
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)
then I put this code in another local script that also went in Starter Player Scripts.
function onKeyPress(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then print("E was pressed") end end game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.E)
the Keyboard inputs did not work? so how do I use multiple keyboard inputs?
local function onKeyPress(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then print(inputObject.KeyCode.Name, "was pressed") end end game:GetService("ContextActionService")BindAction( "keyPress", onKeyPress, false, Enum.KeyCode.R, -- assign multiple keys like this Enum.KeyCode.E )