Controlling script execution order to ensure role management