Create a wave based on a F-curve

I was lurking between tutorials, and saw a really nice effect of what I wanted.
So what did I found was a plane shaped as a wave and cubes that follows the path of the wave.

I wanted to apply the same logic to follow an f-curve to make move the cubes constrained to the wave,so I will have a custom wave that goes along that, I’m pretty sure I’m missing something but I didn’t figured out what.

Im not sure if this is helpful at all but i use f-curve modifiers quite alot to make wave type curves. https://docs.blender.org/manual/en/latest/editors/graph_editor/fcurves/modifiers.html