Inner loops of forEach will safely mask the value of _x from outer loops. Also, where you to pass the name of a script to your function, it would be passed directly to execVM, not passed as part of a string:
{
_crew = crew _x; // _x refers to element of _array
{ [_x] execVM _script } foreach _crew; // _x refers to element of _crew
hint str _x; // _x refers to element of _array
} foreach _array;