I am working on a script that activates certain moves if a key is pressed. Everything seems to be good except for the fact that it's not picking up the key being pressed.
local UserInputService = game:GetService("UserInputService")
local Key = script.Parent
local Hotbar = game.Players.LocalPlayer.PlayerGui.PlayerGUI.Hotbar
local Slot = script.Parent.Parent
local Quirk = game.Workspace.Quirk
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Key then
if Hotbar.Visible == true then
if Quirk ~= "NA" then
Slot.BackgroundTransparency = 0.5
-- add the script that activates the quirk move by setting the remote event name to the specific quirk move name?
end
end
end
end)
At first I had line 9 as:
if input.KeyCode == Enum.KeyCode.Key then
And this gave me an output error saying that Key was not a member/child of KeyCode when I pressed the key, so I tried fixing it by making it what it is in the first script, but now I get nothing from the output when the key is pressed. What do I do?

2 comments
Why do you have the keycode set to the script's parent?
Because the script's parent is a string value with the keycode. I know it seems dumb but I did it because the main parent of all this will need to be cloned with a script and I wouldn't be able to access the clones' keycodes if they're in a script