This example illustrates manually passing serialized data from a Plutus validator and then deserializing it. It uses Plutus.Debug.
Change traceIfFalse to Plutus.Debug.debugIfFalse with added arguments containing the data to be passed out of the script. Here we change
traceIfFalse "R" $ any (checkScriptOutput addr hsh value) allOutputs