Custom Function to update Deal "Amount" based on an "Amount" field in Contacts

Custom Function to update Deal "Amount" based on an "Amount" field in Contacts

I am trying to update the Associated Deal "Amount" based on an input into an "Amount" custom field in Contacts.  I have a custom function to do this in reverse where it updates the Amount on the Contact from the Associated Deal's Amount input but I can't seem to get it to work the other way.