In this tutorial you will see how to easily create a moving locomotive and wagons along the spline track in Unity3D.
Here is the package used in this tutorial: https://zk.ciihuy.com/wp-content/uploads/2019/10/Spline-Walker-Train.zip
Please note that this package and scripts are downloded from https://catlikecoding.com (a good Unity tutorials website) and I modified some files.
For security reason I cannot upload a file with .unitypackage extension to my website, so I compressed it int a zip file. You need to extract it before importing to Unity.