Query for user roles

You can check for specific user role using following code –

if (is_user_logged_in() && current_user_can('administrator')) {}

The function current_user_can() takes role name as parameter.
For more info – https://codex.wordpress.org/Function_Reference/current_user_can/