How to make a moving background?

How would you make a background that moves past you making the illusion that you’re on a moving train/car? I tried to modify a starter place to achieve this but couldn’t get any results.
Right now I have a primitive variation where it’s just 1 part that moves back a certain distance then instantly moves forward creating a seamless loop effect. The problem with this is variation is that it’s very buggy and laggy. What I’m aiming for is a system where it continuously moves back but it adds segments at the front and deletes segments at the back alongside more intricate details like trees, hills, etc.
I’ve been trying to tackle this problem for ages but to no avail, so could someone please help me out here?

1 Like

You can use Beam to Apply a Texture and Move it

2 Likes

What do you mean by gui or roblox 3d?

Use the Search tool and use the term ‘infinite road’.
There have been a few posts about this same concept in the past. You may be able to get some ideas from them.

Hi

Could you elaborate on what you mean by ‘laggy’?
You should be implementing this on the client if you want it to be smooth.

There could also be a problem with how you are moving the parts.

What I mean by “laggy” is that it’s very choppy and at some points stops for some users.

Well, I think the best solution would be to grab a few houses (or whatever you want) and keep spawning them randomly while tweening them past you.

I’ve searched far and wide a while before making this post, and didn’t find anything that could help me.

I just searched infinite road.
Here’s a post that explains it.

Basically they have a model (lets say 600 studs long) that the player starts out on. That model keeps getting cloned and moved 600 studs further forward ahead of the player. The models pass by the player, another clone gets placed ahead of them and the one that’s past the player gets deleted when it’s out of site. The model gets cloned over and over again, place at the front of the line and deleted when it’s farther than it needs to be at the end of the line.
As far as I know CFraming the movement of the models with tweening works pretty well.

I understand how it works, I simply don’t know how to script this from scratch (if it’s even necessary)

You said in your original post that you already implemented the system, but that it was laggy.
Could you show the code you currently have and are you running this on the client?

1 Like

The post I linked to was a post that had a solution and the script was given so you wouldn’t have to do it completely from scratch.
The instructions on how to set it up are in the posts as well.

So far I’ve already set it up, although theres an issue where one part of the background actually moves whereas the rest stay in place. I tried welding the parts to the primary part, nothing.

If you are Tweening the part using CFrames the Tweened Part needs to be Anchored and the other Parts need to be Unanchored and welded to it.

use the parallax effect in your backgrounds