You can think of an array as a "container" with a certain number of items in it. These items are numbered starting with
0. If the array has 3 things in it, for example, there is no item number 4.
What's going wrong for you is that you've created a new empty array (no items) and are trying to assign something to a nonexistent position in the array, i.e. you can't put something in position
0 when there is no position
To add a new item to the array, expanding its size, you use
append() like so:
var ray =  # array is empty
ray.append($RayLeftBack) # ray now has one item
ray.append($RayRightFront) # ray now has two items
# and so on
However, you can also populate the array at creation time:
onready var ray = [$RayLeftBack, $RayRightFront, $RayRightBack, $RayLeftFront]'
See the GDScript and Array documentation for more information. There is also this doc: GDScript: An introduction to dynamic languages which demonstrates techniques for working with arrays.