So, I wrote a gun script, but when the player types the letters E or R in the chat, it will toggle the safety or reload the gun, accordingly.
I don't want this to happen. I've seen plenty of games that don't do this, so I know there's a way.
Here's the script. I've shortened it down considerably, to the parts that are relevant to this problem.
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
print("Key R pressed!")
elseif inputObject.KeyCode == Enum.KeyCode.E then
print("Key E pressed!")
end
end
tool.Equipped:connect(function(mouse)
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
end)
