The player's car following a certain path

Can someone help me (i a new guy to coding)… i want to write a code in Javascript to make the player,s car follow a certian path made by game objects… if I enter the first game object the next one should spawn to show you the next way to go… (like arrows on the road the show the path). the the first game object has to dissappear.

You don’t mention how you want to do this (with physics etc), and there are different
ways to do something like this varying from very simple to very complicated.
So below is a very simple example on how you can do it.

I don’t have code to show, but you can follow these steps, and learn something on the way:

  1. Get the position from the game object you want to move towards.
  2. Interpolate (for instance, use the function Lerp) the car position with your orginal start position, and the position you retrieved from the game object you want to drive towards. (See step 1.)
  3. Use Look At to rotate the car (the car will “look” in that direction) towards the position you want to reach.
  4. When you have reached your position (or whenever you wish) spawn a new object at its proper place and repeat step 1 and 3.

This is a very simple example of how you can do it.