I have a function that chose's a random key from a table containing keys like : Q, E, R, T, Y, etc. Then i made this other function using UIS:
UIS.InputBegan:Connect(function(Input, gameProcessedEvent)
local KeyCode = Input.KeyCode
local keyPress = sgui:FindFirstChild("Menu").status.KPositioner.keyValue.Value
if not gameProcessedEvent then
if KeyCode == Enum.KeyCode.keyPress.Value then
print("WEWE")
end
end
end)
But when i wrote if KeyCode == Enum.KeyCode.keyPress.Value then, it outputs an error. Since the keyPress's Value is a random key from the table, how would i make it so the KeyCode depends on the keyPress's Value?

2 comments
It still shows the Players.YBN_oSy.PlayerScripts.keydownthing:110: bad argument #2 to '?' (string expected, got nil) error
if KeyCode == Enum.KeyCode[tostring(keyPress)] then