How would I make this?

Hello! I would like to know how I can code the cars moving left and right like the video below. The car spawns and then moves left or right.

(Thanks for any feedback)

1 Like

You could use Tween to move the cars from side to side and then after the Tween is played just put the car back to the original position and tween it again whenever you need it.

You could use a PrismaticContraint and change the TargetPosition as needed.

Here is a post that might help:

oh ty sorry for late response but how would i make it in a random side and make them spawn

you could assign the number 1 and 2 to two cars on both sides and using math.random(1,2) to pick which one goes

1 Like