UserInputService is messy. Everything is defined. The only thing that doesn't go according to plan is that the ToggleEquipSword function doesn't trigger when I press One, nor does it notify me in the output that I pressed a key. It only prints the type of user input.
userInput.InputBegan:connect(
function(input)
print(input.UserInputType)
if input.UserInputType == 'Keyboard' then
print('Keyboard') --To let me know that I've pressed a key
if input.KeyCode == Enum.KeyCode.One then
print'1'
ToggleEquipSword()
end
end
end
)
Strangely enough, even though the UserInputType is Keyboard, It doesn't print 'Keyboard' to the output as intended

2 comments
Change line 6 to 'if input == Enum.KeyCode.One then'.
That's not helpful for explaining. Even though your solution is correct. I prefer Taslem's answer.