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)
✓ ANSWER ACCEPTED
Why won't it print when I hit a, am I not referencing it correctly?
1 answer
✓ Accepted answer
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.
2 comments
0
yeah for some reason it started working idk what was wrong before, but thanks!
0
Happy to help :))
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
When I tried using gameProcessedEvent it didnt worked too, tr just ignoring that parameter. . .
is it a LocalScript? it won't work on a ServerScript.
it is a local script
is it in the staterplayer-starterplayerscripts folder?