Reference Devices compiles

all_players_on_team Device: Team-Wide Logic in Verse

The `all_players_on_team` device is your go-to tool whenever you need to know *who is on a team right now* — whether you're awarding a team victory, teleporting an entire squad to a new zone, or checking whether every member has completed an objective. It exposes a clean Verse API that lets you pull the live roster, test membership, and react to eliminations without writing your own bookkeeping code.

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

Overview

In any team-based Fortnite experience — capture-the-flag, zone wars, asymmetric heist — you constantly need to answer two questions: who is on this team? and did something just happen to one of them? The all_players_on_team device answers both.

Drop one (or more) of these devices into your UEFN level, assign each one a Team Setting in the Details panel, and your Verse code can call GetTeamMembers() to get a live []agent snapshot, subscribe to EnemyEliminatedEvent to react when a team member scores a kill, and use IsOnTeam[] to gate logic behind a membership check — all without maintaining your own player lists.

Reach for this device when:

  • You need to iterate every member of a specific team at runtime.
  • You want to trigger team-wide effects (teleport, grant items, end the round) the moment a condition is met.
  • You need to verify that an acting agent belongs to a particular team before applying game logic.

API Reference

(API surface could not be resolved for this device.)

Walkthrough

Scenario: A heist map has two teams — Robbers and Guards. When any Robber eliminates a Guard, the device checks whether all Guards have been eliminated. If so, it broadcasts a win message for the Robbers and teleports every surviving Robber to the victory podium via a teleporter device.

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

# Attach this Verse device to your level.
# Wire up:
#   GuardsDevice  -> the team_settings_and_inventory_device set to the Guards team
#   RobbersDevice -> the team_settings_and_inventory_device set to the Robbers team
#   VictoryTeleporter -> a teleporter_device at the victory podium

heist_round_manager := class(creative_device):

    # The team_settings_and_inventory_device configured for the Guards team.
    @editable
    GuardsDevice : team_settings_and_inventory_device = team_settings_and_inventory_device{}

    # The team_settings_and_inventory_device configured for the Robbers team.
    @editable
    RobbersDevice : team_settings_and_inventory_device = team_settings_and_inventory_device{}

    # Teleporter placed at the victory podium.
    @editable
    VictoryTeleporter : teleporter_device = teleporter_device{}

    # Called once when the experience starts.
    OnBegin<override>()<suspends> : void =
        # Subscribe to the Guards team elimination event.
        # EnemyEliminatedEvent fires with the eliminating agent each time
        # a member of the *other* team eliminates someone on this team.
        # Here we use it on the Guards device so we know when a Guard is eliminated.
        GuardsDevice.EnemyEliminatedEvent.Subscribe(OnGuardEliminated)

    # Handler called every time a Guard is eliminated.
    # The parameter is the agent who scored the elimination (a Robber).
    OnGuardEliminated(EliminatingAgent : agent) : void =
        # Get the current live roster of Guards.
        var RemainingGuards : []agent = GuardsDevice.GetTeamMembers()

        # If no Guards remain, the Robbers win.
        if (RemainingGuards.Length = 0):
            TriggerRobbersVictory()

    # Teleport every surviving Robber to the victory podium.
    TriggerRobbersVictory() : void =
        var Robbers : []agent = RobbersDevice.GetTeamMembers()
        for (Robber : Robbers):
            VictoryTeleporter.Teleport(Robber)```

### Line-by-line explanation

| Lines | What's happening |
|---|---|
| `@editable GuardsDevice` / `RobbersDevice` | Declares the two `all_players_on_team_device` references so UEFN can wire them in the Details panel. Without `@editable` the fields are invisible to the editor. |
| `@editable VictoryTeleporter` | A standard `teleporter_device` we'll use to move winners. |
| `GuardsDevice.EnemyEliminatedEvent.Subscribe(OnGuardEliminated)` | Subscribes to the event that fires whenever an enemy of the Guards team scores an elimination. The handler receives the *eliminating* agent. |
| `GuardsDevice.GetTeamMembers()` | Returns a live `[]agent` of every player currently on the Guards team. We check `.Length = 0` to detect a wipe. |
| `RobbersDevice.GetTeamMembers()` | Pulls the Robbers roster so we can teleport each one. |
| `VictoryTeleporter.Teleport(Robber)` | Teleports each Robber agent to the podium. |

---

## Common patterns

### Pattern 1 — Gate an action behind team membership

Before handing out a bonus item, confirm the acting agent is actually on the correct team.

```verse
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# A button that only rewards players on the Blue team.
blue_team_bonus_button := class(creative_device):

    @editable
    BlueTeamDevice : all_players_on_team_device = all_players_on_team_device{}

    @editable
    BonusGranter : item_granter_device = item_granter_device{}

    @editable
    BonusButton : button_device = button_device{}

    OnBegin<override>()<suspends> : void =
        BonusButton.InteractedWithEvent.Subscribe(OnButtonPressed)

    OnButtonPressed(Agent : agent) : void =
        # IsOnTeam[] is a failable expression — use it inside an `if`.
        if (BlueTeamDevice.IsOnTeam[Agent]):
            BonusGranter.GrantItem(Agent)
        else:
            Print("Nice try — Blue team only!")

Pattern 2 — React when a team member is eliminated

Track how many times the Red team has been eliminated and end the round after a threshold.

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

elimination_tracker := class(creative_device):

    @editable
    RedTeamDevice : all_players_on_team_device = all_players_on_team_device{}

    @editable
    RoundEndDevice : end_game_device = end_game_device{}

    # Mutable counter — how many Red team eliminations have occurred.
    var RedEliminationCount : int = 0

    # Maximum eliminations before the round ends.
    EliminationLimit : int = 5

    OnBegin<override>()<suspends> : void =
        # EnemyEliminatedEvent on RedTeamDevice fires when a Red player
        # is eliminated by an enemy.
        RedTeamDevice.EnemyEliminatedEvent.Subscribe(OnRedTeamMemberEliminated)

    OnRedTeamMemberEliminated(Eliminator : agent) : void =
        set RedEliminationCount += 1
        Print("Red team eliminations: {RedEliminationCount}")
        if (RedEliminationCount >= EliminationLimit):
            RoundEndDevice.Activate(Eliminator)

Pattern 3 — Remove a temporary team member and restore them

Some modes temporarily shuffle players into special squads. Use RemoveTemporaryMemberFromTeam to cleanly return a player to their original team.

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

temp_team_cleanup := class(creative_device):

    # Device configured for the "Special Ops" temporary team.
    @editable
    SpecialOpsDevice : all_players_on_team_device = all_players_on_team_device{}

    # A trigger that fires when the special-ops phase ends.
    @editable
    PhaseEndTrigger : trigger_device = trigger_device{}

    OnBegin<override>()<suspends> : void =
        PhaseEndTrigger.TriggeredEvent.Subscribe(OnPhaseEnded)

    OnPhaseEnded(Agent : ?agent) : void =
        # Snapshot everyone currently on the Special Ops team.
        SpecialOpsMembers := SpecialOpsDevice.GetTeamMembers()
        for (Member : SpecialOpsMembers):
            # Return each temporary member to their original team.
            SpecialOpsDevice.RemoveTemporaryMemberFromTeam(Member)
        Print("All Special Ops players returned to original teams.")

Gotchas

1. @editable is mandatory

If you declare MyTeamDevice : all_players_on_team_device = all_players_on_team_device{} without @editable, the field is never wired to a placed device — every call operates on a default, empty object and GetTeamMembers() returns an empty array. Always add @editable and assign the device in the UEFN Details panel.

2. GetTeamMembers() is a snapshot, not a live reference

GetTeamMembers() returns the roster at the moment of the call. If you store the array and check it later, it may be stale. Re-call the method each time you need fresh data (e.g., inside your elimination handler, not once in OnBegin).

3. IsOnTeam[] is failable — always use it in a failure context

IsOnTeam[] uses the <decides> effect, meaning it either succeeds or fails rather than returning a bool. You must call it inside an if, race, or other failure context:

# CORRECT
if (BlueTeamDevice.IsOnTeam[Agent]):
    # agent is on the team

# WRONG — compile error
result := BlueTeamDevice.IsOnTeam[Agent]

4. EnemyEliminatedEvent fires for the eliminator, not the eliminated player

The event parameter is the agent who scored the elimination (the enemy of this team), not the team member who was eliminated. If you need to identify the eliminated player, cross-reference GetTeamMembers() before and after, or use a separate PlayerEliminatedEvent from the playspace.

5. RemoveTemporaryMemberFromTeam is a no-op for permanent members

Calling RemoveTemporaryMemberFromTeam on a player who was never added as a temporary member does nothing and does not fail — it silently succeeds. This is safe but can mask logic bugs if you expect it to move permanent team members.

6. Team Setting must be configured in the editor

The device only knows about the team you set in the Team Setting property in the UEFN Details panel. If you forget to set it, the device defaults to an unassigned team and GetTeamMembers() will always return an empty array at runtime.

Build your own lesson with all_players_on_team

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 →