Scrolling Text - Not Working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    The text scrolls on a loop continuedly.

  2. What is the issue? Include screenshots / videos if possible!
    It doesn’t scroll, and there are no errors related to it in the output.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried looking on here, but nothing was discovered.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local text = (script.Parent.TextLabel)

while wait() do
	for _, v in pairs(text) do
		local temp = v.Position.X.Scale
		if (temp <= -v.Size.X.Scale) then
			temp = 1.0
		end
		v.Position = UDim2.new(temp - 0.01, 0, 0.4, 0)
	end
end

image

1 Like

Are you trying to do something like this? You should consider using Tweens instead. They are easier to work with and they can loop on their own.

Source code:

local sf = script.Parent --ScrollingFrame
local tl = sf:WaitForChild('TextLabel')

local tws = game:GetService('TweenService')
local tween: Tween

local function update(scrollingSpeed: number)
	local size: number = tl.AbsoluteSize.Y
	local coverage: number = size - sf.AbsoluteWindowSize.Y --the maximum canvas Y position at the very bottom of the text
	
	local twi: TweenInfo = TweenInfo.new(
		coverage/scrollingSpeed,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.InOut,
		-1, --loop forever
		true, --reverse the Tween before loop
		2 --wait 2 seconds between loops
	)
	
	if tween then
		tween:Cancel()
	end
	sf.CanvasPosition = Vector2.zero
	tween = tws:Create(sf, twi, {CanvasPosition = Vector2.new(0, coverage)})
	tween:Play()
end

update(50)
tl:GetPropertyChangedSignal('Text'):Connect(function()
	update(50)
end)

I wanted it so the text goes from right to left on a continuous loop.

Then it’s just a matter of changing a few letters in the code.

Here’s the place file that includes both of them, go play around with it and let me know if you have any other questions.
scrollingText.rbxl (54.0 KB)