UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(input, gameProccesedEvent) if input.KeyCode == Enum.KeyCode.A then print("YO DAWG COME SEE DIS HE PRESSIN DA A KEY!!") end end)
There is no problem in your script, it works properly. But if it doesn't print what you want, then check if your script is a LocalScript
and is located in StarterGui
. If it still does not work, type this code inside of your script:
UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(input, GPE) if input.KeyCode == Enum.KeyCode.A then print("YO DAWG COME SEE DIS HE PRESSIN DA A KEY!!") end end)
And if it still does not, try this:
local keyDown = false UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(input, GPE) if input.KeyCode == Enum.KeyCode.A then keyDown = true print("YO DAWG COME SEE DIS HE PRESSIN DA A KEY!!") end end)
If even that doesn't work, try contacting Roblox staff about the problem, but there should not be any problems.