How do I use tee but retain the exit result code!

I have a script called script1 which returns a result code. However the script itself also calls other scripts which frequently display important messages we need to capture. Unfortunately

script1 | tee -a LOGFILE

captures the messages, but loses the result code, because the act of calling tee resets it to 0. We need to be able to both see the messages at runtime and also keep them stored in LOGFILE. How can I still do both of these and yet not destroy the rc from script1?  
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

gheistConnect With a Mentor Commented:
(script1 ; (echo $? >.temp-id) ) | tee -a WHATEVER
All Courses

From novice to tech pro — start learning today.