using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /Verse.org/Native } my_lock_script := class(creative_device): @editable LockedDoor : lock_device = lock_device{} @editable ControlButton : button_device = button_device{} OnBegin() : void = LockedDoor.Lock() ControlButton.InteractedWithEvent.Subscribe(RunUnlockLogic) RunUnlockLogic(Agent : agent) : void = LockedDoor.Unlock() Print("Door Unlocked! Loot is yours.") # Spin up a background task so the button stays responsive # while we wait to re-lock. spawn { RelockAfterDelay() } # lets us use Sleep() to pause without freezing the game. RelockAfterDelay() : void = Sleep(5.0) LockedDoor.Lock() Print("Door Locked again. Too slow!")