Subscribing to Device Events in Verse
In this lesson you'll learn to
- Explain what an event and a handler (listener function) are, using a real Fortnite button device as the example.
- Use Subscribe() to connect a Verse function to a button_device's InteractedWithEvent so something happens when a player presses the button.
- Write a simple handler function that receives an agent (the player who triggered the event) and runs game logic.
- Place a Button device and a Verse device in UEFN and link them together with the @editable tag.
🎮 What Is an Event?
Imagine you set a tripwire trap in your bedroom. The second someone walks through it — ZAP! — a buzzer goes off. The "someone walks through the wire" moment is called an event. An event is something that happens during the game that your code can listen for and react to.
In Fortnite Creative, devices already have built-in events. For example:
- A Button device has an event called
InteractedWithEvent— it fires whenever a player walks up and presses the button. - An Input Trigger device has
PressedEventandReleasedEvent— they fire when a player presses or lets go of a certain key.
📻 What Is Subscribing?
Think of a podcast subscription. Once you subscribe, every new episode shows up automatically. You don't have to check manually!
Subscribing to an event works the same way. You tell Verse: "Hey, whenever this button is pressed, automatically call MY function." After that, your code runs itself every single time the event fires — no manual checking needed.
The word for doing this in Verse is Subscribe().
🤚 What Is a Handler?
The function you connect to an event is called a handler. Think of a handler like a catcher's mitt in baseball. The event throws the ball (signals that something happened), and your handler catches it and decides what to do next.
In Verse, a handler is just a regular function — but it must follow one rule: it must accept the right inputs. For a button_device's InteractedWithEvent, the handler must accept one input called an agent. An agent is Verse's word for the player who triggered the event.
🏗️ How Do You Set It All Up?
Here are the four steps you follow every time:
- Place your devices — Drop a Button device and a Verse Device onto your island in UEFN.
- Add an
@editableproperty — This is a special tag that lets you drag and drop your Button device into your Verse script from the UEFN editor panel. Think of it like a slot on a LEGO brick where you plug another brick in. - Subscribe in
OnBegin—OnBeginis the function that runs the instant your island starts. It's the perfect place to set up your subscriptions, so they're ready before any player touches anything. - Write your handler function — This is the code that actually runs when the button is pressed.
🔌 Quick Vocab Cheat Sheet
| Word | Plain Meaning |
|---|---|
| Event | Something that happens in the game (button pressed, player arrives, timer ends) |
| Subscribe | Sign up to be notified when an event happens |
| Handler | Your function that runs when the event fires |
agent |
The player who caused the event |
@editable |
A tag that lets you link a device to your script in the UEFN editor |
Keep going — free
You've read the intro. The rest of this lesson — the worked example, the hands-on exercise, the quiz, and the recap — is free for members. Sign in to continue and track your progress.
New here? The whole Verse Basics track is free with a free account — sign in to start.
Sources
/docs/documentation/en-us/fortnite/coding-device-interactions-in-verse /docs/documentation/en-us/uefn/verse-api/fortnitedotcom/devices/input_trigger_device /docs/documentation/en-us/uefn/verse-api/fortnitedotcom/devices/button_device /docs/documentation/en-us/uefn/coding-device-interactions-in-verse© Biloxi Studios Inc. — original Verse Island content.
Turn this into a guided course
Add Subscribing to Device Events in Verse 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.
🧭 The Keeper's log
Quest complete? Chart your next heading from the Creative Devices 101 expedition.