I was running a simple piece of code and i came upon a error, outputs not giving me anything
local UserInputService = game:GetService("UserInputService") local aKeyPressed = false UserInputService.InputBegan:Connect(function(input, gameProccesed) if input.KeyCode == Enum.KeyCode.A then aKeyPressed = true while aKeyPressed == true do wait() print("A Key is being held") end end end) UserInputService.InputEnded:Connect(function(input, gameProccesed) if input.KeyCode == Enum.KeyCode.A then aKeyPressed = false end end)
It's not
if UserInputService == Enum.KeyCode.A then
its the parameter you use, which in this case is "input" EDIT: forgot to put ".KeyCode"
if input .KeyCode== Enum.KeyCode.A then