Adding a role using Members and Formidable Forms [closed]

You want to use the method WP_User::set_role() https://developer.wordpress.org/reference/classes/wp_user/set_role/

If you want to add the role as an additional role, replace set_role with add_role

add_action( 'frm_after_create_entry', 'inactive_to_member', 20, 2 );
function inactive_to_member($entry_id, $form_id) {
    if ( $form_id == 21 ) { // form id of the form to copy

        $user = wp_get_current_user(); //get logged in user
        if ( !$user ) {
            return; //don't continue if user doesn't exist
        }

        // Get user roles
        $user_roles = $user->roles;
        // Make sure they're not an administrator
        if ( !in_array( 'administrator', $user_roles ) ) {
            // Make Role Census Club         
            $user->set_role( 'census_club' );
        }
    }
}