Hide Buttons and Fields based on User Roles

I want to hide “Create Invoice”, “Create Purchase”, and other buttons on the “Create” button list for custom User “Orders User” who is supposed to only create Sales Orders and Material Requests but Its not working for client script of this code.

frappe.ui.form.on(‘Sales Order’, {
refresh(frm) {
// your code here
if (frappe.user_roles.includes(‘Orders User’)){
setTimeout(() => {
frm.remove_custom_button(‘Update Items’);
frm.remove_custom_button(‘Next Document’);
frm.remove_custom_button(‘Previous Document’);
frm.remove_custom_button(‘Request for Raw Materials’, ‘Create’);
frm.remove_custom_button(‘Pick List’, ‘Create’);
frm.remove_custom_button(‘Delivery Note’, ‘Create’);
frm.remove_custom_button(‘Sales Invoice’, ‘Create’);
frm.remove_custom_button(‘Purchase Order’, ‘Create’);
//frm.remove_custom_button(‘Material Request’, ‘Create’);
frm.remove_custom_button(‘Payment Request’, ‘Create’);
frm.remove_custom_button(‘Payment’, ‘Create’);
frm.remove_custom_button(‘Work Order’, ‘Create’);
frm.remove_custom_button(‘Subscription’, ‘Create’);
frm.remove_custom_button(‘Project’, ‘Create’);
frm.remove_custom_button(‘Send SMS’, ‘Menu’);
}, 10);

Use Below Custo Script

frappe.ui.form.on(‘DocType’, {
onload (frm) {
setTimeout(() => {
}, 10);