local ContextActionService = game:GetService("ContextActionService")
local function onEPressed(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
print("E was pressed!")
end
end
ContextActionService:BindAction("PrintMessage", onEPressed, false, Enum.KeyCode.E)
Explanation:
"PrintMessage" β name of this action.onEPressed β function that runs when E is pressed.false β donβt create a mobile touch button.Enum.KeyCode.E β the key to bind.ContextActionService:UnbindAction("PrintMessage")