Here is what I got.
local HitAKey = game.Players.LocalPlayer:GetMouse().KeyDown local Name = game.Players.LocalPlayer.Name HitAKey:connect(function(key) if key == 'e' or 'E' then print(Name.." has pressed E!") elseif key == 'q' or 'Q' then print(Name.." has pressed Q!") end end)
But when I press any keyboard button, like A, it prints "Player1 has pressed E!" But it still prints that if I press W, A, S, D keys again!
use UserInputService
Make sure it's in a local script!
game:GetService("UserInputService").InputBegan:connect(function(input) local playerName = game.Players.LocalPlayer.Name if input.KeyCode == Enum.KeyCode.Q then print(playerName.."Has pressed Q") elseif input.KeyCode == Enum.KeyCode.E then print(playerName.."Has pressed E") end end)