Im trying to make a StringValue determine the key for an input service function, but it isn't working.

Key1 = script.Parent.Key1


local function onKeyPress(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.Key1.Value then
		print(Key1.Value.." was pressed")
	end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)