How to have if shell script returns success but also save result into variable in one `if` ideally

I want to do this but not only check that it returns success but also save result of that script into variable for later use.

ok nvm its just