Verse Library verse

01 Fragment

Unlocks a door when a player interacts with a button while holding a specific key item.

verse-library/using-conditional-button-devices-in-fortnite-creative/01-fragment.verse

# This is a simple Verse script for a Conditional Button
# It checks if the player has the key item.

# Define the key item we are looking for
Key_Item := Item_Shop_Shield_Potion

# This function runs when someone interacts with the button
On_Button_Press(Interaction) -> void:
    # Check if the player has the key item
    If (Interaction.Player.Has_Item(Key_Item)):
        # If they have it, open the door
        Door.Open()
    Else:
        # If they don't have it, do nothing
        # The player feels stuck, which is good for puzzles!
        Print("You need the key to open this door!")

Comments

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