using { /Fortnite.com/Devices }
# A simple device that shows a message when triggered.
simple_hud_device := class(creative_device):
# The device that does the displaying
var hud: hud_message_device = create()
# This variable holds the message text
var message_text: string = "Welcome to the Island!"
# This runs when the game starts
on begin_play() -> unit:
# Set up the look of the message
hud.SetMessageText(message_text)
hud.SetMessageColor(ColorCyan)
hud.SetMessageDuration(3.0)
# This event is triggered when another device sends a signal to this one.
# You wire a Pressure Plate's "On Trigger" to this device's input.
on trigger() -> unit:
# Get the player who triggered it?
# Actually, for a simple "All Players" message, we don't need the player.
# But let's make it personal!
# We can't easily get the *triggering* player in a simple on trigger()
# without more complex event handling. So let's do a global "Game Over" style message.
hud.Show("Game Over! You stepped on the trap.")
Verse Library
verse
02 Device
Device that displays configurable custom messages to players when triggered by another interactive element.
verse-library/fortnite-hud-message-device-show-a-custom-message/02-device.verse