using { /Fortnite.com/Devices } using { /Verse.org/Sim } # This is our main script. # It watches the tree and the button. class MyTreeScript is WorldDevice(): # This is the tree device. # We will link it in the editor. TreeDevice: physics_tree_device = physics_tree_device() # This is the button player steps on. # We will link it in the editor too. TriggerButton: button_device = button_device() # This runs when the game starts. OnBegin(): void = # We listen for when the button is pressed. TriggerButton.PressedEvent.Subscribe(SimulateFall) # This function makes the tree fall. SimulateFall(): void = # We tell the tree to start falling. # It will now obey gravity. TreeDevice.Fall() # We wait a little bit. # This gives time for the tree to move. Wait(2.0) # Now we check if the tree is on the ground. # If it is, we print a message. if TreeDevice.IsOnGround(): Print("The tree has crashed down!")