Legacy GM Undo and redo the points of a path


Greetings to all
I have this doubt, in a Room I have several instances of objects that function as levels that when clicking click access to a different level and under those objects I have an open path with 46 points as if it were a path, as well as "Candy Crush", This is only for something aesthetic, with this I want to know if I can achieve that by advancing to another level I can make the path that I have already created from the editor advance to its next point (which should only have the first point drawn at the beginning). go forward with each level). So:

This is the closest code I found shared by a user named Aura in 2016, but I get this error:
trying to index a variable which is not an array
at gml_Object_obj_mypath_CreateEvent_1 (line 3) - time_array [i - 1, 0] = time_array [i, 0];
This is the code that user posted:

by Aura:
"The best way would be to keep a 2D array with 30 slots with two subslots each where position is stored every few steps."
for (var i = 1; i <= 30; i ++)
     time_array [i - 1, 0] = time_array [i, 0];
     time_array [i - 1, 1] = time_array [i, 1];
 time_array [30, 0] = x;
 time_array [30, 1] = y;
Now when you want to go back in time, add points to the path on the go.
// path_clear_points (path0);
 for (var c = 30; c> = 0; c--)
     path_add_point (path0, time_array [c, 0], time_array [c, 1], 100); // you may use path_change_point ()
Last edited: