local inputServe = game:GetService("UserInputService") inputServe.InputBegan:Connect(function(input, gameProccesedEvent) if input.KeyCode == Enum.KeyCode.G then print("G pressed.") end end)
There is no errors that happened. It's in a local script, and its in starterplayerscripts
Hi, try changing 'input' in your function parameters to something else, like this
local inputServe = game:GetService("UserInputService") inputServe.InputBegan:Connect(function(inputKey, gameProccesedEvent) if inputKey.KeyCode == Enum.KeyCode.G then print("G pressed.") end end)
Unless there is something else in your script this should be working.
game:GetService("UserInputService").InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.G then print("G Pressed.") end end)
Add a LocalScript to StarterGui and type this:
local Service = game:GetService("UserInputService") Input.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.G then print("G was pressed") end end)
I Had This Error Too, First It Has To be In A Local Script And Try To Put The Local Script In The Backpack