Redirect logged in users from a custom post type archive page if they don’t have a specific role

Please check the code where you wrote array_intersect.
array_intersect function return null array if it doesn’t find any match. So your condition checking using !array_intersect is invalid.

tech