VerseBuilderDocs

Docs/Recipes/Score tracker

Recipe: Score tracker

Track per-player eliminations, show the running total on the HUD, end the round when someone hits the target.

Last updated 2026-06-06

Ingredients

  • Variable kills — int, scope player, persist off, default 0.
  • Config kill_target — int, default 20.
  • UEFN devices: 1 Elimination Manager, 1 HUD Message device (for the running tally).

Build it

  1. Add the variable and config

    Open Game Data. In Variables, add kills (int, player, persist off). In Config, add kill_target (int, default 20). Designers can tweak the target in UEFN.
  2. Increment on every elimination

    New rule: WHEN On Elimination → DO Increment Variable kills by 1, Show Variable HUD kills. The agent passed by the event is the eliminator, so we credit the killer.
  3. End when someone hits the target

    Second rule: WHEN On Elimination IF Compare variable kills ≥ kill_target → DO End Game. Order doesn't matter — both rules listen to the same event; the End Game rule gates itself with the threshold.

💡 Tip

Pin the HUD widget to a corner of the screen using the HUD editor. Use a label like "Kills: {kills}" with the variable token to make it readable.

Generated Verse

# Rule A: WHEN On Elimination DO Increment kills
# Rule B: WHEN On Elimination IF kills >= kill_target DO End Game
EliminationManager.EliminatedEvent.Subscribe(OnElim)

OnElim(Result:elimination_result):void=
    if (Raw := Result.EliminatingCharacter?, Agent := Raw.GetAgent[]):
        SetKills(Agent, GetKills[Agent] + 1)
        HUDMessage.Show(Agent, FormatKills(GetKills[Agent]))
        if (GetKills[Agent] >= KillTarget):
            spawn{ EndGameAfterDelay() }
Both rules compile to subscriptions on the same event. The second one's IF becomes a failable expression.

Variations

  • Team scoring — swap per-player kills for a global team counter, gate with Is on team.
  • Time-limited — add a round_time config and a Timer device; end the game on either threshold first.
  • Score by weapon — multiple variables (kills_pistol, kills_smg), branch in the increment rule.

Gotchas

⚠️ Watch out

Persist OFF. Round counters should reset every match — don't tick “persist” on kills or last round's tally will carry over.

⚠️ Watch out

Eliminator vs. eliminated. The agent on On Elimination is the killer; use On Eliminated if you want to track deaths instead.

See also