Skip to content

Marquee

A single line that slides to show all of itself when it is wider than its space, then slides back, holding a moment at each end. Use it for song titles, tickers and names on boards, where wrapping would break the layout. With loop on it goes round instead, like a ticker: a copy of the text follows the first one a gap behind, so it never stops or jumps back.

Marquee exampleMarquee example
local track = app.state:ref("server.dj.title")

Lucy.Panel.new({
    title = "Now playing",
    size = UDim2.fromOffset(220, 0),
    children = {
        Lucy.Marquee.new({
            text = function()
                return track() or ""
            end,
            variant = "large",
        }),
    },
    Parent = nowPlaying,
})

Text that fits stays still and left aligned. It only moves while visible, and starts again from the beginning whenever its text changes, except with loop: a ticker carries on from where it was, so live text such as a score or a countdown never makes it stop. When the player asks for reduced motion it stays still, cut off at the edge.

The Marquee fills its parent’s width and is as tall as one line of its variant, so give it a parent with a width, such as a Stack column.

Props

PropTypeDefaultState keyWhat it does
textstring""yesThe line
variantstring"p"yesIts style: any Text variant
visiblebooleantrueyesShows or hides it, and starts or stops the moving
speednumber40Pixels a second while it moves
pausenumber1.5Seconds it holds at each end; with loop, only before it first moves
loopbooleanfalseGoes round in one direction, its copy following, instead of back and forth
gapnumber48Pixels between the text and its copy when it loops
richTextbooleanfalseTurns on Roblox rich text tags such as <b>

It also takes the props every component takes.

It scrolls all the way to the end of its text in a scaled UI too (a UIScale above it, as Lucy’s own on a phone): Lucy.Marquee.scaleOf(instance) gives how much the UIScales above an instance scale it, all together.

handle.strip is the moving TextLabel, for your own rules: tag it and style it with tokens. handle.scrolling says whether it is moving right now. With loop, handle.repeatStrip is the copy; it takes its text size, colour and font from the strip, so style the strip.

Examples

A smaller second line beside the title, with rich text:

Lucy.Marquee.new({
    text = `{title}  <font size="14" transparency="0.25">{artist}</font>`,
    variant = "h3",
    richText = true,
    Parent = panel,
})

A slower ticker that waits longer at each end:

Lucy.Marquee.new({
    text = "Sign up at the Booth to dance in the next round",
    variant = "muted",
    speed = 25,
    pause = 3,
    Parent = footer,
})

A ticker that goes round without stopping, for a long line of news:

Marquee exampleMarquee example
Lucy.Panel.new({
    size = UDim2.fromOffset(300, 0),
    children = {
        Lucy.Marquee.new({
            text = "Sign ups are open at the Booth · DJ Lucy is on the decks · Next round in 2 minutes",
            variant = "large",
            loop = true,
            speed = 90,
        }),
    },
    Parent = ticker,
})

Preview

In Studio, from the command bar: Lucy.Preview.show("Marquee").