Fixing uneven scrolling background?

don’t know if this fits art or scripting support

so i have a scrolling background in my game, it’s just two of the same images that tween and replace eachother. how can i patch this annoying line? look at the background of the dialogue in the video


(PLEASE ignore the actual text :pray:)

script if you need it, got it from somewhere on the Forums

local Background1 = script.Parent -- Make the first background image a variable that we can call
local Background2 = Background1.Parent:WaitForChild("BG2") -- Make the second background image a variable that we can call

game:GetService("RunService").RenderStepped:Connect(function() -- Call for RunService

	Background1.Position += UDim2.new(0.001, 0, 0, 0) -- Update the Positions : NOTE - You can change the xScale if you want to make the ImageLabel's position move faster.
	Background2.Position += UDim2.new(0.001, 0, 0, 0) -- Update the Positions

	if Background1.Position.X.Scale >= 1 then -- Check if the Background Position Scales X axis changed and if it has reached the scale of 1
		Background1.Position = UDim2.new(-1, 0, 0, 0) -- Reset's the position back to the start, with the second image now being around the {0, 0, 0, 0} mark for its position and taking the first images place.
	elseif Background2.Position.X.Scale >= 1 then -- Same thing but just checks for the second image.
		Background2.Position = UDim2.new(-1, 0, 0, 0) -- Also does the same thing, but now the first background image takes the crown back and is now filling in for the second background image
	end -- The background images switching places like this makes it so that one of these background images are always filling in a place for the other.
end)

maybe try combining both backgrounds into one frame? then you can just change that one frame’s position?

feels like there is a better way to fix this line causing delay, but try it out i guess.

Guy, i think the easiest way is to make a video of this, and put it to repeat again and again, to look exactly like this

I don’t think it’s the easiest way

or the cheapest…

1 Like

Could you maybe use 9slice and tween the properties? Could be easier or smoother potentially, maybe easier to loop?

1 Like

if i did that it would be very hard to get it to reset and make it look clean

ill try that, never used 9slice before

1 Like

got it to work with a different scrolling script that uses one background

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.