Skip to main content

Groups & Lists

Most blocks act on one thing: one player, one item. But often you want many at once: everyone in the room, every player on the finish line, a whole list of high scores. This page covers two tools for "many things": player groups and lists.

The clipboard idea

A single player is like one name tag you're holding. A group is like a clipboard with several name tags clipped to it. A list is the same clipboard, but it can hold any kind of thing: numbers, words, coordinates, players.

The good news: almost every "do something to a player" block happily takes either a single name tag or the whole clipboard. So you can point one block at one person, or at a hundred.

Block snippetOne name tag targets one player; a clipboard of tags is a group, and the same action runs once per tag.
Groups and lists are cousins

A player group is basically a list of players. Anywhere a block wants "a group of players," it'll also accept a single player or a list of players. They're interchangeable. Don't worry about the exact distinction; the editor sorts it out for you.

Player groups: grabbing many players at once

A group is a handle that points at several players. The blocks that make a group live in the Groups category. Here are the ones you'll reach for most often.

Everyone in the room

All PlayersA group of every real player currently in the world.

All Players is the simplest group: everyone who's connected right now. Plug it straight into any block that takes players (like "notify all players" or "teleport all players") to affect the whole room.

Everyone standing in a zone

Players In AreaA group of every player currently standing inside a chosen area.

Players In Area collects everyone standing inside an area you pick. Perfect for a finish line, a danger zone, or a lobby. If nobody's there, you get an empty group. That's normal, not an error.

There are a couple more group-makers worth knowing:

BlockWhat it grabs
Players Sitting At ObjectEveryone seated on a chair object
Players Holding ObjectEveryone holding a particular object
Gotcha: groups never contain NPCs

Every group block collects real humans only. NPCs are never in a player group. To control NPCs, head to the NPCs page instead.

Under the hood: a group is a snapshot

"All Players" is like a doorman writing down everyone in the room at that exact second. If someone walks in two seconds later, they are not in a group you grabbed earlier; you'd have to ask for "All Players" again to get the fresh crowd. Groups don't auto-update. Also, players who have left the room are quietly skipped when the action actually runs, so you never act on a ghost.

Picking one player out of a group

Sometimes you have a group but want just one member:

BlockWhat it doesIf the group is empty
Random Player From GroupPicks one member at randomGives back "no player"
Nearest Player From GroupThe member closest to a pointGives back "no player"
Closest PlayerThe closest of everyone in the roomGives back "no player"
"Nearest" searches a group; "closest" searches the room

Nearest Player From Group looks only inside the group you hand it. Closest Player ignores groups and searches every human in the room. Easy to mix up, so pick based on whether you care about a subset or the whole room.

When a picker comes back empty

If a group is empty, these pickers hand back "no player." Plug that into an action and the action does nothing; it doesn't crash. So when it matters, check first (see counting, below).

Counting a group

Count Players In GroupTells you how many players are in a group, as a number.

Count Players In Group gives you a number, which is handy for gating a game. A classic: "if count of all players is at least 4, start the round." (You'll combine this with the if block.)

Targeting a whole group with one action

Here's the magic. Take any block that targets players (like Teleport Players or Notify Players) and drop a group into its player slot. The action runs once for each member.

Reward everyone on the finish line
  1. When Room Starts (or a timer)
  2. Notify Players → players: Players In Area (the finish-line area) → text: "You made it!"

Every player standing on the line gets the message. Nobody else does. One block, a whole crowd.

Singular and plural are the same block

You'll see both "Teleport Player" and "Teleport Players." They do the exact same thing; the only difference is the friendlier label. "Teleport Player" will happily accept a group, and "Teleport Players" will happily accept a single player. Use whichever reads nicer.

An empty audience usually does nothing, or means "everyone"

Two things to know:

  • If the group you pass is empty, the action runs on nobody and quietly stops. No error.
  • On many effect and cinematic blocks, leaving the player slot blank defaults to all players, not nobody. So a blank audience often means "the whole room."

Lists: storing many things

A list is a collection of values in order. Unlike a group (which only holds players), a list can hold numbers, text, coordinates, objects, or areas, one kind per list. Think of it as a numbered shopping list, or a row of LEGO bricks lined up.

You'll usually keep a list in a variable so it sticks around and grows over time. (See Variables for how variables work.)

Building a list

List With Item AddedGives you a copy of a list with one more item added to the end.

List With Item Added is how you grow a list. But there's a catch worth understanding:

Gotcha: this makes a copy

List With Item Added doesn't change the original list. It hands you back a brand-new copy with the item on the end. To actually make a list variable grow, you have to store the result back into that variable:

set list variable guests to (list guests with triggering player added)

If you forget the "store it back" part, the list never changes. (There are also handy Add To List action blocks that grow a variable directly, which is often simpler.)

A few more list reads you'll use:

BlockWhat it tells you
Length Of ListHow many items are in the list (a number)
List IncludesWhether the list already has a certain item (true/false)
Item At IndexThe item at a position (the first is position 0)
Counting starts at zero

Item positions (called indexes) start at 0, not 1. A list of 3 items has positions 0, 1, and 2. To get the last item, use length minus 1. Asking for a position that doesn't exist gives you "nothing" rather than an error.

For-each: doing something to every item

The real power of a list (or a group) is the for-each loop. It runs a set of blocks once for every item, and hands you each item in turn through a Loop Item block.

For EachRuns the blocks inside it once for every item in a list, or every player in a group.

Because a player group counts as a list of players, you can loop straight over a group to do custom per-player logic, beyond what a built-in action allows.

Give every player in a zone +1 point

for each player in (Players In Area arena) do:   set player variable score of (loop item player) to score + 1   notify (loop item player) → "Point scored!"

The loop runs once per player. Inside, "loop item player" is whoever the loop is currently on, so each person gets their own point and their own message.

When to loop vs. when to just target the group

If you only need a built-in action (teleport, notify, set emote), drop the group into that action and skip the loop. Reach for for-each when you need custom steps per player, like changing a per-player variable or running an "if" check on each one.

Under the hood: loop details
  • An empty list (or group) runs the body zero times. That's normal.
  • Changing the list while you loop over it can cause skipped or repeated items. It's safer to build a new list than to edit the one you're looping.
  • Want to loop a fixed number of times with no list? Use Repeat N Times instead.

Quick reference

You want…Use…
Everyone in the roomAll Players
Everyone in a zonePlayers In Area
One random personRandom Player From Group
How many are in a groupCount Players In Group
Do an action to a whole crowdDrop the group into the action
Custom steps per playerFor Each over the group
Store many valuesa list in a variable
Grow a listList With Item Added (store it back!)

What's next?