Hi out there, I am heroguy1134 and I am learning to script and I made a script in which the script is supposed to print "The player pressed the A key " when I press the A key but it ain’t working. Can anyone help me with this?
UserInputService.InputBegan:Connect (function(Input , gameProccesedEvent)
if Input.KeyCode == Enum.Keycode.A then
print (“The player pressed the A key”)
end
end)
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.A then
print("Player pressed A")
end
end)
Edit: You didn’t put userInputservice as a local variable.I think that is the error