Infinite moving road

I’m trying to make an infinite road that moves backward but generates tiles but I’m not sure how to even start on such a system.

Picture explanation(ms paint):


the player cannot look backward

I have no idea how to start on such a system so any help would be appreciated, thank you.

7 Likes

Create a script that teleports the player to the back section when he or she goes to the front section.

3 Likes

i do not want the player to move what so ever
like not even a decimal of a stud

3 Likes

Use the Search tool up above and type in ‘infinite moving road’.
There are a few posts that show ways of doing it.

2 Likes

I’ve used it before making this post.
it mainly has stationary infinite generation or something completely unrelated, doesn’t have much to offer.

2 Likes

You could create a loop and a table that would delete/move the last tile back to the front

3 Likes

Make a long road then use tweenservice to do move to the road 1 stud or how much you want every second and it should give an infinite illusion.

2 Likes

Is the camera stationary or can it be rotated?

2 Likes

In my way it can but the player should not go to the edge ofcourse.

2 Likes

Couldn’t you just move the texture on the road to achieve the same infinite effect?

2 Likes

You can but the material if applied won’t move which kind of ruins the illusion. Also moving the entire road overall is a better idea because who knows that the OP could be using 3d lines?

2 Likes

it can be rotated 80 degrees in both directions

1 Like

I want trees and other structures to pass by as well. the reason I want a tile system is I can make presets and areas(biome in a sense)

I plan on making areas such as highway/freeway or backside country roads. I can do all of that I just don’t know where to start on the moving mechanic cause it involves cframes(I am not good with frames)

2 Likes

got this far:

local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Map = game.Workspace:WaitForChild("Map")

local roads = {}

local roadsize = 123
local roadlength = 5
local roadspeed = 2
local roadtween = TweenInfo.new(roadspeed,Enum.EasingStyle.Linear)

-- Start Generation
if #Map.CenterRoad:GetChildren() ~= roadlength then
	local initalstart= ReplicatedStorage.Road:Clone()
	initalstart.Parent = Map.CenterRoad
	initalstart.Name = "Road1"
	local amount = 1
	for i = 1,roadlength-1 do
		local rdcl = ReplicatedStorage.Road:Clone()
		rdcl.Parent = Map.CenterRoad
		rdcl:SetPrimaryPartCFrame(CFrame.new(-9,0,roadsize*-amount)*CFrame.Angles(0,-math.pi/2,0))
		rdcl.Name = "Road"..amount + 1
		amount += 1
	end
	for _, i in	pairs(Map.CenterRoad:GetChildren()) do
		table.insert(roads,i)
	end
end

-- move backward
while true do
	for _, i in	pairs(roads) do
		if i.PrimaryPart.Position.Z >= roadsize then
			local index = table.find(roads,i)
			table.remove(roads,index)
			i:Destroy()
		else
			local moveroadlmao = TweenService:Create(i.PrimaryPart,roadtween,{["CFrame"] = CFrame.new(i.PrimaryPart.Position+Vector3.new(0,0,roadsize))*CFrame.Angles(0,-math.pi/2,0)})
			moveroadlmao:Play()
		end
	end
	task.wait(roadspeed)
end

one problem

why does it do that :sob::sob::sob:

1 Like

try increasing the road size and length, i think that’ll help