Scrolling text in a TextLabel

I am trying to make a scrolling textlabel, so that the text scrolls and shows the train’s destination.

The script:

local images = {script.Parent}

while wait() do 
	for _,v in pairs(images) 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, 0)
	end
end

What the TextLabel looks like in Studio mode:
image

What it looks like in Playtest mode:

How have you done the textbox?

Or is it done as one block on a frame?

Can you show me a pic of the Explorer tab of how youve done the gui, etc…

I think I know your problem.

image

There is your problem. You have put all the Guis into one part. And you have added a scrolling part of which has overlapped the other guis. So, Seperate the parts into their rows. This should solve your problem.

How can I make it stop before the “Calling at:”?

How can I also stop when it gets to the last letter and not the first?

Ib that case you have to separate the Calling at and Ashford road scrolling and adjust the part if which holds the scrolling text as a barrier for when it reaches the Calling at.

Do you mean different levels of text (drop text), perhaps something like this?

Name -
Text -
Etc...

If so, then in your script you should add a \n in between your text so that the text drops down to a new level/sentence.

I want to make the Calling at: stay still but the stations fade out when they reach Calling at. I want it to keep scrolling until the last station has been seen

You can concatenate the text you want to display into a string, and only display a substring with fixed characters with increasing starting index. The other option is to make scrolling text a text label under a frame with ClipsDescendants. If you care about localization it might be more compatible to use the second option.
I have an example place that includes both of the options.
scrollingText.rbxl (45.8 KB)

2 Likes

Is there a way to make it stop after it has cycled once?

You can do it by tweening ScrollingTextLabel’s position from UDim2.fromScale(1, 0) to UDim2.fromScale(-ScrollText.AbsoluteSize.X/parentClipFrame.AbsoluteSize.X, 0) once.

How can I do that? I’m not a very good scripter.

I published the model here that supports loop/wrap configuration:

You can check the sample usage here:
SampleUsage.rbxl (36.4 KB)
There is a script called ExampleUsage in ServerScriptService

For your use case, you want to scroll the text once and stop by changing its position from 1 to -scale with small lerps in between. My implementation has extra code for other minor edge cases.