Help with user input service

Hello, I’m trying to make a custom keybind system and make it where If key == KeyBind.Value then

But for some reason it doesn’t let me do it off of a value and only KeyDown let’s me use a value as a Key, how would I use input service and if the key == a value then it works? So a value is e and if they press the button the value is it works?

did you try

if key.KeyCode == KeyBind.Value then
    -- code here
end
-- and not
if key == KeyBind.Value then

end

Oh i usually do this
-ima do this off mobile so I might do it a bit wrong


UserInputService.InputBegan:Connect(Function(Key) 
If key == Keybind.Value then

Alright I’ll try it out ur tomorrow thanks

yes that seems fine but the only problem is the key == Keybind.Value,
key isn’t a letter on the keyboard, its a whole input uh I don’t know how to explain.UserInputService.InputBegan


so please use

UserInputService.InputBegan:Connect(function(key) 
    if key.KeyCode == Keybind.Value then

    end
end)

hope that helps :happy1:

for some reason this doesnt work, when i put the Value to E or e it doesnt do anything, i did the script u put

sorry I am late, can i see your code? and the KeyBinds’ Value? :happy3:
You need to make sure the value is either “E” or Enum.KeyCode.E yeah, eee thx for reading!