Cant define array from other script

Hello, I’m trying to define array in another script and i got this error:
“IndexOutOfRangeException: Index was outside the bounds of the array.
(wrapper stelemref) System.Object.virt_stelemref_sealed_class(intptr,object)”

my code:

int order = 0;
foreach (ActionList Order in ...)
        {
            Main.ActionName[order] = Order. ...;
            order++;
        }

Main script:

public string[] ActionName = new string[10];

However

When i define array in same script. i don’t recive error:

string[] ActionName = new string[10];
int order = 0;
foreach (ActionList Order in ...)
        {
            ActionName[order] = Order. ...;
            order++;
        }

(… are non relate code to problem)

nvm i figured it out

by directly use script

ActionClick.ActionName[order] = Order. ...;