Verse Player Teleportation with a Button and UI Feedback
What you'll learn
- How to subscribe to a
button_device'sInteractedWithEventand read the pressingagent. - How to move a player instantly using the
teleporter_device.Teleport()API. - How to fetch a player's HUD with
GetPlayerUI[]and confirm they are a realplayer. - How to build and add a
text_blockwidget so the player sees feedback.
How it works
The official fort_character.TeleportTo you may have seen is a <decides> method on storm beacons, not a general "move any player here" call. For moving players reliably, the grounded, supported path is the teleporter device: place a teleporter_device at your destination and call Teleport(Agent) on it. That handles the actual relocation for us.
- Place a Button device and a Teleporter device (the teleporter marks the destination).
- In
OnBegin, subscribe a handler toButton.InteractedWithEvent. Button events send anagentpayload. - In the handler, call
Destination.Teleport(Agent)to move the player. - Narrow the
agentto aplayer(withplayer[Agent]) so we can look up their HUD. - Call
GetPlayerUI[Player]inside a failure context, build atext_block, andAddWidgetit.
Let's build it
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/UI }
# A creative device that teleports the pressing player and shows a HUD message.
teleport_button_device := class<concrete>(creative_device):
# The button players interact with to trigger the teleport.
@editable
TeleportButton : button_device = button_device{}
# A teleporter placed at the destination. Calling Teleport(Agent) moves the player here.
@editable
Destination : teleporter_device = teleporter_device{}
OnBegin<override>()<suspends>: void =
# InteractedWithEvent sends the agent who pressed the button.
TeleportButton.InteractedWithEvent.Subscribe(OnButtonPressed)
# Handler runs each time the button is pressed. Payload is the pressing agent.
OnButtonPressed(Agent : agent): void =
# Move the agent instantly to the destination teleporter.
Destination.Teleport(Agent)
Print("Teleporting agent to destination.")
# Show HUD feedback — only players (not AI agents) have a player_ui.
ShowMessage(Agent)
# Builds a text widget and adds it to the player's HUD.
ShowMessage(Agent : agent): void =
# Narrow agent -> player; GetPlayerUI needs a player and both are fallible.
if:
Player := player[Agent]
PlayerUI := GetPlayerUI[Player]
then:
# Create the widget, then add it to this player's HUD.
Label := text_block{DefaultText := "Teleported!"}
PlayerUI.AddWidget(Label)
Try it yourself
- Add a second
teleporter_devicefield and randomly pick a destination each press. - Change the
DefaultTextto interpolate a value:text_block{DefaultText := "Warped {1} time(s)!"}after tracking a counter. - Remove the widget after a delay by storing it and later calling
PlayerUI.RemoveWidget(Label). - Play a sound or VFX by enabling a
vfx_spawner_devicein the handler.
Recap
- Button events (
InteractedWithEvent) deliver anagent, not aplayer— narrow withplayer[Agent]when you need HUD access. - Use
teleporter_device.Teleport(Agent)to relocate a player; it's the grounded, supported way to move players. GetPlayerUI[Player]is a<decides>call, so it MUST live in a failure context (anifcondition).- Build widgets like
text_block{...}and attach them withPlayerUI.AddWidget(...)for on-screen feedback.
Check your understanding
Test yourself with an interactive quiz and track your progress + earn XP — free for members.
Turn this into a guided course
Add Implementing Player Teleportation via TeleportTo 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.
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.