# This is our main script. It controls the game logic. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } my_button_script := class(creative_device): @editable MyButton: button_device = button_device{} @editable MyPropManipulator: prop_manipulator_device = prop_manipulator_device{} # A 'var' variable can be changed after it is created. # 'false' means the prop is not yet activated. var IsActivated: logic = false OnBegin(): void = # Loop forever so the button keeps working after the first press. loop: # Wait here until the player presses the button. MyButton.InteractedWithEvent.Await() # Check the current state and flip it. if (IsActivated?): # It was activated, so deactivate it. MyPropManipulator.Deactivate(player{}) set IsActivated = false Print("Deactivated!") else: # It was not activated, so activate it. MyPropManipulator.Activate(player{}) set IsActivated = true Print("Activated!")