Help With Infinite Scrolling Background (Model)

Hey there. A friend and I are making a chill game where there’s a car and of course the moving background. I’ve attempted numerous amount of times to make it loop but I cant seem to make it look the way I want it. I want to know how I could make it look seamless and infinite so it goes on forever. Thanks for your time!

explanation drawing

crap code (server)

function MoveBackground()
	local background = game:GetService("Workspace")["Background"]
	local info = TweenInfo.new(10, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
	while true do
		local CFrameValue = Instance.new("CFrameValue")
		CFrameValue.Value = background:GetPrimaryPartCFrame()
		
		CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
			background:SetPrimaryPartCFrame(CFrameValue.Value)
		end)
		
		local tween = game:GetService("TweenService"):Create(CFrameValue, info, {Value = background:GetPrimaryPartCFrame() * CFrame.new(0, 0, 1024)})
		tween:Play()
		
		tween.Completed:Wait()
		CFrameValue:Destroy()
		
		local newBackground = background:Clone()
		newBackground.Parent = game:GetService("Workspace")
		newBackground:SetPrimaryPartCFrame(background["Start"].CFrame)
		background:Destroy()
		background = newBackground
	end
end
coroutine.wrap(MoveBackground)()

video

2 Likes

could you show an example of what exactly is going wrong?

1 Like

I have found a solution for myself.

1 Like

Apologies for bumping, but it would be helpful if you showed what solved your problem, so that other people with similar problems can solve it too.