Hello Alejandro,
If you drop one element from the library into another in the 3D, the one you dropped will be inside the first one. This mean that if the first one moves, the dropped one will move as well.
For your example, you can use an AGV to move in a rail and a robot inside de AGV, but you have to create it so that first the AGV moves and then the robot starts working.
This is a proof of concept. I just did it to show you how to make a rail so is not as organized as it could.
It is using processFlow, but it can be done differently.
RobotRail.fsm