When customising some functions or controls, we have found that sometimes you have a text version of a OptionSet value. If you want to patch this then Power Apps will error.
The following has helped.
If the custom control is called for example, ddCustomDropdown:
Text(Value) = ddCustomDropdown.SelectedItem.Value
We stored the value as locNameOfTheVarable. We can now call that when we patch.
Don't forget to put another ")" but you should be right to go.