The action you did copy as is requires to be used in a loop, for the value of loopindex to change. Moreover, it requires to be called inside a function that will receive a paramater (function.param(0)).
The reset an array, use the dedicated action "Clear".
That should be enough to reset the array to 0.
It is a template with certain complexities in terms of abstraction.
If you are a complete beginner, you should probably get used to Construct first going through simpler templates and understanding how events work.
The reading of the manual does help greatly for that.