See how to make a simple train with boxes moving on a looping rails. All You need is a circle (curve), a cube and a rail segment.
See my portfolio https://dziarskilisek.pl/portfolio
00:10 preparing path
00:47 preparing locomotive
01:12 preparing rail segment
02:35 setting curve animation
03:00 ‘Follow path’ constrint for locomotive
03:27 adding the wagons to locomotive
04:15 number of laps
04:55 fitting rails to the path (Array and Curve modifiers)
Remember that cube and rail segment must be located at same place as circle (path) in the object mode.