Looped moving floor

Hi everyone!
I’m trying to make a system that has a looped moving floor to make an illusion of movement for a train like this

(this is a mock up of the bare bones system I’m looking to achieve that i made on moon animator)
https://gyazo.com/028aab4bc97a440ed80e75712063ce29

I want to know the best and most optimized way to make this. preferably without part of the map flying under like in the animation.

I’ve tried looking it up to no avail and I’m not sure how to tackle this.

Thanks!

Tween the parts in a line, setting the front-most part’s position to the back of the line when it reaches a certain point.

Hey so i got the track to move how I want but how would I go about welding something to the parts that are moving? I tried to put a weld constraint to one of the moving parts and a separate part but the separate part doesn’t move.

also I have a gut feeling that this isn’t the best way to code this.. any tips would help tons

--config
local speed = .5

--functions
local function movePart(part)
	if part.Position.Z < finalPoint.Position.Z  then
		part.Position = startPoint.Position
		local tweenInfo = TweenInfo.new(speed, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
		local tween = TS:Create(part, tweenInfo, {Position = part.Position + Vector3.new(0, 0, -180)})
		tween:Play()
	else
		local tweenInfo = TweenInfo.new(speed, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
		local tween = TS:Create(part, tweenInfo, {Position = part.Position + Vector3.new(0, 0, -180)})
		tween:Play()
	end
end


--code

script:GetAttributeChangedSignal("isMoving"):Connect(function()
	while script:GetAttribute("isMoving",true) do
		movePart(movingPart1)
		movePart(movingPart2)
		movePart(movingPart3)
		movePart(movingPart4)
		movePart(movingPart5)
		movePart(movingPart6)
		task.wait(speed + .001)
	end
end)

Hi, @aj_the1.

I don’t think playing tween is good (players will see jittering moving floor because delayed replication), try use AlignPosition or something like motor6d (weldconstraint and etc)

Try using the Search tool up top and the term infinite road track. There have been quite a few posts about this topic in the past, most with good suggestions and solutions. :grinning_face:

i would use tweens on the client, and an invisible version on the server for server purposes