The code below is used to move the front segment of an infinitely scrolling background to the back. The part where the Welds are disabled is undesirable for obvious reasons, yet if I don’t do that, the PivotTo()
function will bring the entire background backwards. Is there another way to do this? I don’t want to use MoveTo()
local function movetoBack()
for _, v in pairs(script.Parent:GetDescendants())do
if v:IsA("WeldConstraint") then
v.Enabled = false
end
end
currentfront:PivotTo(currentlast.BACK:GetPivot())
for _, q in pairs(script.Parent:GetDescendants())do
if q:IsA("WeldConstraint") then
q.Enabled = true
end
end
local backid = currentfront.Name
currentlast = script.Parent[backid]
local frontid = tostring(tonumber(currentfront.Name)+1)
if frontid == "6" then
frontid = "1"
end
currentfront = script.Parent[frontid]
end