:I'm trying to make a function that, when a player presses a certain key, it connects this remote event I already have set up. The remote event is functioning fine, but for some reason it gives me an error when I try to create the keybind function. I used one from the Roblox Developer wiki, and tweaked it a tiny bit to connect the keybind to this string value. What needs to be changed in my script?
function onKeyPress(inputObject, gameProcessedEvent)
local value = script.Parent.ChordA.Value
if inputObject.KeyCode == Enum.KeyCode(value) then
print("ChordA Was Invoked")
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Here's the error code it's giving me:
Workspace.NoteTrack.Keybinds.ConnectKeyBinds:2: attempt to call field 'KeyCode' (a userdata value) 18:59:19.223 - Stack Begin 18:59:19.225 - Script 'Workspace.NoteTrack.Keybinds.ConnectKeyBinds', Line 2 18:59:19.227 - Stack End

2 comments
What is ChordA's value?
I set the value to one capital letter, just as it would be in the script.