How to make epic mini games crossroad game

Hello. I am wanting to make a game like the epic mini game Crossroads where cars randomly drive through the road. I already have it where a model will move to a certain position with a certain speed, but I want to have multiple cars randomly clone and do that. Here’s my script.

--local tsunami = script.Parent.TsunamiWave
--local startPosition = Vector3.new(189.5, 29.51, -9) -- Starting position of the tsunami
--local endPosition = Vector3.new(-84.5, 29.51, -9) -- Ending position of the tsunami
--local moveTime = 20 -- Time in seconds for the tsunami to reach the end position

---- Tween setup
--local TweenService = game:GetService("TweenService")
--local tweenInfo = TweenInfo.new(moveTime, Enum.EasingStyle.Linear)
--local goal = {CFrame = CFrame.new(endPosition)}

---- Create and play the tween
--local tween = TweenService:Create(tsunami.PrimaryPart, tweenInfo, goal)
--tween:Play()

local model = script.Parent.Train -- Replace with your model's name
local targetPosition = Vector3.new(-3.042, 23.627, 175) -- Replace with your target position
local duration = 5 -- Duration in seconds

-- Calculate the initial distance between the model and the target
local startPosition = model.PrimaryPart.Position
local distance = (startPosition - targetPosition).magnitude
local speed = distance / duration -- Speed to move over 30 seconds

-- Function to move the model
local function moveModel()
	if model then
		local startTime = tick() -- Record the start time
		while (tick() - startTime) < duration do
			-- Calculate the interpolation factor based on elapsed time
			local elapsed = tick() - startTime
			local alpha = math.clamp(elapsed / duration, 0, 1)

			-- Linearly interpolate towards the target position
			local newPosition = startPosition:Lerp(targetPosition, alpha)
			model:SetPrimaryPartCFrame(CFrame.new(newPosition))

			wait(0.01) -- Short wait to create a smooth movement effect
		end

		-- Ensure the model reaches the exact target position at the end
		model:SetPrimaryPartCFrame(CFrame.new(targetPosition))
		print("Model moved to the target position!")
	else
		warn("Model not found!")
	end
end

-- Call the move function
moveModel()


Why u dont using TweenService? Its more optimized and smoother. Also I would like to ask what you want with this post? You didn’t ask the question.

If you still want to keep this method instead of TweenService, you should write a task.spawn so that the code doesn’t wait for the function to complete, but can use it for the new machine right away