Verse Library verse

01 Fragment

Waits for a button press to toggle a ready state and print messages, ideal for basic UI or lobby triggers.

verse-library/ready-to-jump-in/01-fragment.verse

# This script manages the lobby ready-up system.
# It lives on a Verse Script device in your UEFN scene.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# 1. DEFINE THE COMPONENTS
# We need to reference the Button device we placed in the editor.
# Think of this as pointing your finger at the button.
# 'MyButton' is the name we give it in our code.
var MyButton := button_device

# 2. DEFINE THE STATE (THE VARIABLE)
# 'IsReady' is our variable. It starts as False.
# It's like a flag that says "Not Ready Yet."
var IsReady : bool = false

# 3. DEFINE THE EVENT HANDLER
# This function runs whenever someone clicks the button.
# 'InteractedWithEvent' is the signal from the button.
# 'Await()' pauses this code until the button is clicked.
# It’s like waiting for the bus to arrive before you get on.
OnButtonClicked := func() -> void:
    # Wait for the player to click the button
    MyButton.InteractedWithEvent.Await()
    
    # Once clicked, change the variable to True
    # This is like flipping the switch from OFF to ON
    IsReady = true

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in