The Traitor Trap: Build a "Who’s The Spy?" Voting System in UEFN
Unverified — this example may not compile as-is.
The Verse code below did not pass our automated compile check, so it isn't marked verified and is hidden from the guide listing. The explanation may still be useful, but treat the code as a draft and adapt it before use.
The Traitor Trap: Build a "Who’s The Spy?" Voting System in UEFN
So, you want to turn your Fortnite island into a high-stakes game of social deduction? Maybe you’re channeling your inner Among Us crewmate or just want to let your players decide who gets eliminated next. The secret sauce isn’t magic—it’s the Voting Group and Voting Options devices.
These two work together like a lock and key. One defines the question (the Vote), and the other defines the answers (the Options). When you link them up, you get a system where players can actually influence the game state. No more guessing games—just pure, democratic chaos.
What You'll Learn
- How the Voting Group acts as the "polling station" manager.
- How Voting Options serve as the individual ballots.
- How to link them using ID Strings (the digital glue holding your vote together).
- How to trigger a vote using a simple button press.
How It Works
Think of a vote like a Storm Circle shrinking down to a final showdown. Before the storm hits, everyone is free to move. But once the timer starts, you have to pick a spot or get caught in the damage.
In UEFN, the Voting Group is that timer. It’s the central hub that decides when the voting starts, when it ends, and who is allowed to vote. It doesn’t care what the options are; it just manages the clock and the authority.
The Voting Options are the spots in the storm. Each option is a separate device. If you have three players you want to vote on, you need three separate Voting Option devices. Each one holds a single choice (e.g., "Player A," "Player B," "Player C").
The magic happens with the ID String. Imagine every player has a unique squad code. For the devices to talk to each other, they need to agree on the same "channel." You set a specific ID (like 1 or SpyVote) on the Voting Group, and then you paste that exact same ID into every Voting Option device you connect to it. If the IDs don’t match, the devices are like two people shouting in different languages—they hear each other, but understand nothing.
Let's Build It
We’re going to build a "Who’s The Traitor?" setup. Players will walk into a room, press a button, and vote to eliminate one of three suspects.
Step 1: Set Up the Suspects (Voting Options)
- Open your Content Drawer.
- Go to Devices > Logic.
- Drag out three
Voting Optiondevices. Let’s call themOption_A,Option_B, andOption_C. - Select all three. In the Details panel, find the Voting Group ID field.
- Type
TraitorVoteinto that field for all three. This is your "channel."
Step 2: Set Up the Polling Station (Voting Group)
- Drag out one
Voting Groupdevice. Call itPollingStation. - In the Details panel, find the Voting Group ID field.
- Type
TraitorVotehere too. It must match the options exactly. - Set the Start Time to
0(or leave it blank if you want to trigger it manually). - Set the Duration to
10seconds. This gives players 10 seconds to decide who to eliminate.
Step 3: Connect the Trigger
We need a way to start the vote. A button is perfect.
- Place a
Buttondevice near your voting area. - Click the Output pin on the Button.
- Drag the line to the Input pin on the
PollingStation(Voting Group). - Now, when you press the button, the 10-second timer starts.
Step 4: The Result (What Happens When It Ends?)
Right now, the vote happens, but nothing visual occurs. To make it cool, let’s add a Prop Mover or a Volume that triggers when the vote ends.
- Place a
Volumedevice where you want the "eliminated" player to go (or where a trap triggers). - Go to the
PollingStationdevice. - Find the On Vote Ended output pin.
- Connect that pin to the Input pin of your
Volume.
Now, when the 10 seconds are up, the Volume activates! You can wire that Volume to a Prop Mover to drop a cage, or a Sound Emitter to play a dramatic "Eliminated" sound.
The Verse Connection (For the Coders)
If you’re writing Verse, you don’t need to wire these manually. You can control them via code. Here is how you might structure a simple Verse device that manages this logic.
Note: This example uses standard Verse patterns for Creative devices. It assumes you have placed the devices in the level and referenced them.
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This is our custom device class. Think of it as the "Brain" of the voting system.
TraitorVoteManager := class(creative_device):
# These are the devices we placed in the level.
# We connect them in UEFN, but we reference them here.
@editable VoteGroup : voting_group_device = voting_group_device{}
@editable OptionA : voting_option_device = voting_option_device{}
@editable OptionB : voting_option_device = voting_option_device{}
@editable OptionC : voting_option_device = voting_option_device{}
# This function runs when the game starts
OnBegin<override>()<suspends>:void=
# We can check if the vote has started
if VoteGroup.Is_Voting():
Print("The Traitor Vote Has Begun! Choose Wisely.")
else:
Print("Wait for the button press to start the vote.")
# This function runs when a player interacts with our trigger (e.g., a button)
StartVote<override>()<suspends>:void=
# Start the voting group
VoteGroup.Start_Voting()
# Wait for the duration (e.g., 10 seconds)
Wait(10.0)
# Check the results
# Note: In a real scenario, you'd get the winning option and act on it
# For now, we just print that the vote ended
Print("Vote Ended. The Traitor has been revealed!")
Walkthrough of the Code:
class(creative_device): This tells Verse "I am making a new device that can be placed in UEFN."@editable: This tag makes the variable appear in the UEFN editor so you can drag-and-drop your actual Voting Group and Options devices into these slots.Start_Voting(): This is the Verse equivalent of pressing the button. It kicks off the timer.Wait(10.0): This pauses the code for 10 seconds, exactly like the Duration setting in the device.
Try It Yourself
Challenge: Add a "Reveal" mechanism.
Currently, the vote ends, and the Volume triggers. Can you wire a Prop Mover to that Volume so that a trapdoor opens and a "Traitor" prop falls into a pit?
Hint: You’ll need to connect the Volume’s output to the Prop Mover’s "Activate" input, and set the Prop Mover’s target position to be "down" or "inside" the pit.
Recap
- Voting Group is the timer and manager. It needs a unique ID String.
- Voting Options are the choices. Each needs its own device and the same ID String.
- Link them by matching the IDs.
- Trigger the vote with a Button or Verse code.
- React to the result with Volumes, Props, or Sounds.
Now go forth and let your players decide each other’s fates. Just don’t blame me if you get voted off the island.
References
- https://dev.epicgames.com/documentation/en-us/fortnite/using-voting-group-and-voting-options-devices-in-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/36-10-fortnite-ecosystem-updates-and-release-notes
- https://dev.epicgames.com/documentation/en-us/fortnite/squid-game-create-voting-opportunities-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/community/snippets/2rrO/fortnite-voting-system
- https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/vote_option_interface
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add using-voting-group-and-voting-options-devices-in-fortnite to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.
References
Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.