Reference Verse compiles

hud_message_device: Broadcasting Leaderboard Standings on the Cove

A raw score list means nothing until it flashes across the screen. On our sunny cel-shaded cove, the hud_message_device is the pirate megaphone that shouts the standings to every treasure hunter — while a player-UI text widget pins a personal banner to each screen. This guide teaches both the device's real Verse API and the GetPlayerUI/AddWidget path that actually puts pixels on a HUD.

Updated Examples verified on the live UEFN compiler
Watch the Knotplayer in ~90 seconds.

What you'll learn

  • How to drive a real hud_message_device from Verse with SetText, Show, SetDisplayTime, Hide, and ClearAllMessages.
  • How to author a localized message (with interpolated parameters) instead of passing a raw string.
  • How to subscribe to the device's ShowMessageEvent to react when a banner appears.
  • How to pin a personal standings banner to each player using the player-UI stack: GetPlayerUI[], AddWidget, a canvas and a text_block.

How it works

The hud_message_device is your beach-wide announcer. Its two most useful calls are:

  • SetText(Text:message) stores the message, then Show() (or Show(Agent)) displays it.
  • Show(Message:message, ?DisplayTime:float) does both at once. DisplayTime := 0.0 shows the banner forever until you Hide(); a positive value auto-hides.

Every text parameter is a message, not a string — so we declare a <localizes> function like LeaderMessage(Name:string, Coins:int):message. Interpolation ({Name}, {Coins}) fills in live data.

That covers the shared shout. For a personal banner that each hunter carries, we drop to the player-UI layer: GetPlayerUI[Player] (fallible — bind it in an if), then AddWidget(...) a canvas whose slot holds a text_block. This is the piece the requirement demands — it actually paints a widget onto one player's HUD, independent of the device's queue.

Let's build it

using { /Fortnite.com/Devices }
using { /Fortnite.com/UI }
using { /UnrealEngine.com/Temporary/UI }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# Localized message — interpolates live leaderboard data into a `message`.
LeaderMessage<localizes>(Name:string, Coins:int):message = "Captain {Name} takes the lead — {Coins} coins!"

cove_leaderboard := class<concrete>(creative_device):

    # The shared beach megaphone. Configure Display Time in User Options too.
    @editable
    Announcer:hud_message_device = hud_message_device{}

    # Stepping on this pad marks a new leader for the demo.
    @editable
    LeadPad:trigger_device = trigger_device{}

    OnBegin<override>()<suspends>: void =
        # React when the device actually shows a banner on someone's screen.
        Announcer.ShowMessageEvent.Subscribe(OnBannerShown)
        # New-leader pad drives both the shared shout and a personal widget.
        LeadPad.TriggeredEvent.Subscribe(OnNewLeader)

    # Called by the device once a message is on-screen.
    OnBannerShown(Agent:agent):void =
        Print("HUD banner shown on the cove.")

    OnNewLeader(MaybeAgent:?agent):void =
        if (Agent := MaybeAgent?):
            # Demo standings — in a real game read these from your score store.
            Name := "Bella"
            Coins := 300
            # Persistent shared shout (0.0 = stays until Hide/ClearAllMessages).
            Announcer.SetDisplayTime(0.0)
            Announcer.SetText(LeaderMessage(Name, Coins))
            Announcer.Show()
            # Pin a personal banner directly onto THIS player's HUD.
            PinPersonalBanner(Agent, Name, Coins)

    # Uses the real player-UI stack: GetPlayerUI[] + AddWidget + canvas/text_block.
    PinPersonalBanner(Agent:agent, Name:string, Coins:int):void =
        if:
            Player := player[Agent]
            PlayerUI := GetPlayerUI[Player]
        then:
            Banner := text_block{DefaultText := LeaderMessage(Name, Coins)}
            Root := canvas{Slots := array{
                canvas_slot{
                    Anchors := anchors{Minimum := vector2{X := 0.5, Y := 0.1}, Maximum := vector2{X := 0.5, Y := 0.1}},
                    Alignment := vector2{X := 0.5, Y := 0.0},
                    SizeToContent := true,
                    Widget := Banner
                }
            }}
            PlayerUI.AddWidget(Root)

Try it yourself

  • Change DisplayTime from 0.0 to 3.0 in SetDisplayTime and watch the shared banner auto-hide.
  • Call Announcer.ClearAllMessages() from a second trigger to wipe every queued banner at once.
  • Swap Announcer.Show() for Announcer.Show(Agent) so only the triggering hunter sees the shout.
  • Read real coin totals from your own map/score store instead of the hard-coded 300.

Recap

  • SetText + Show (or the combined Show(Message, ?DisplayTime)) drive the hud_message_device; 0.0 display time is persistent.
  • Text params are message values — build them with a <localizes> interpolated function, never a raw string.
  • Subscribe to ShowMessageEvent/ClearAllMessagesEvent to react to banner lifecycle.
  • For per-player HUD pixels, use GetPlayerUI[Player] (fallible) then AddWidget a canvas holding a text_block.

Guides & scripts that use player

Step-by-step tutorials that put this object to work.

Build your own lesson with player

Generate a personalized, step-by-step lesson plan built around this object — grounded in this exact reference and our compile-verified knowledge base.

Build a lesson →