function KeyPrimary(actionName, userInputState, inputObject) print(userInputState) if userInputState == Enum.UserInputState.Begin then print("1 was pressed") end end game.ContextActionService:BindAction("keyPress", KeyPrimary, false, Enum.KeyCode.One)
When I use this it only prints the userInputState as I let go of 1, how come it doesn't work when I push it down?
plr = game.Players.LocalPlayer char = plr.Character mouse = plr:GetMouse() mouse.KeyDown:connect(function(key) print("Button Pressed: "..key) if key:byte() == 17 then -- up arrow print("find more bytes ^ look at bottom of answer!") end end)
So basically keybinding a "number" such as 1-9 or 0 cannot be done; you have to do, key:bytes which the bytes refer to the data (numbers) which refer the a keyboard input, enjoy! for more keyboard inputs; go to http://wiki.roblox.com/index.php?title=Keyboard_input_(deprecated)
[make sure to add the (deprecated) in the link or look up Keyboard input (deprecated) at the roblox wiki]