You don't need a CollisionShape node at all, because that's only used in the editor. When adding a collision shape with script you have to do it differently. This code should work:
# create an Area object
var area = Area.new()
# add the area as a child node
self.add_child(area)
# connect body_enter Signal to Area
area.connect("body_enter", self, "_on_Area_body_enter")
# create a BoxShape
var col = BoxShape.new()
# adjust the BoxShape size
col.set_extents(Vector3(currentMoveSpaces * 10, 1, currentMoveSpaces * 10))
# add BoxShape to Area object
area.add_shape(col, Transform()) # Change the Transform() if you need to change the position
# set the shape of Area to be a trigger
area.set_shape_as_trigger(0, true) # This requires the shape index, since there's only one shape it will be 0
you add a shape with area.add_shape(shape, transform)
, the transform can be used to change the rotation, scale, and position of the shape relative to the parent.
To set the shape as a trigger you have to call area.set_shape_as_trigger(shape_index, bool)
, since you're adding only one shape the index will be 0.
Note this is the same for all CollisionObject's, both 3D and 2D.