How to enable custom button for certain user roles

Hello guys.
I have a custom button (‘Transfer’) on a custom doctype. I want users with specific roles to be able to click on the custom button. how do I go about it?

client script

can you help with the script?

refer to this sample code available in client script screen

// additional permission check
frappe.ui.form.on('Task',  {
    validate: function(frm) {
        if(user=='user1@example.com' && frm.doc.purpose!='Material Receipt') {
            msgprint('You are only allowed Material Receipt');
            validated = false;
        }
    } 
});

i want to check
if(user=="user1@example.com" && role ==“Equipment Manager”)
then enable custom_button (‘Transfer Equipment’).
pls help me to arrange it in script

the ‘Material Receipt’ is it custom button?

refer to this one How to make Custom button visible to User with specific role - #2 by szufisher.