# Source URL: https://dev.epicgames.com/community/snippets/Evp/fortnite-trigger-a-barrier-with-a-time-limit
# Local doc: epic-docs/community/snippets/Evp/fortnite-trigger-a-barrier-with-a-time-limit.md
using { /Verse.org/Simulation }
using { /Fortnite.com/Devices }
barrier_timer := class<concrete>(creative_device):
@editable
Barrier:barrier_device = barrier_device{}
@editable
Trigger:trigger_device = trigger_device{}
@editable
BarrierButton:button_device = button_device{}
@editable
Timer:timer_device = timer_device{}
OnBegin<override>()<suspends>:void=
BarrierButton.InteractedWithEvent.Subscribe(OnButtonInteractedWith)
Trigger.TriggeredEvent.Subscribe(OnTriggerTriggered)
Timer.SuccessEvent.Subscribe(DisableBarrier)
OnButtonInteractedWith(Player:player):void=
Barrier.Enable()
Timer.Begin(Player)
OnTriggerTriggered(Player:player):void=
Timer.Begin(Player)
DisableBarrier(Player:player):void=
Barrier.Disable()
Expand code Copy full snippet(27 lines long)
* ```
Begin Map
Begin Level
Begin Actor Class=/Game/Creative/Devices/TimerDevice/BP_Device_Timer.BP_Device_Timer_C Name=BP_Device_Timer_C_3 Archetype=/Game/Creative/Devices/TimerDevice/BP_Device_Timer.BP_Device_Timer_C'/Game/Creative/Devices/TimerDevice/BP_Device_Timer.Default__BP_Device_Timer_C'
Verse Library
verse
01 Snippet
Automates barrier activation and deactivation using linked buttons, triggers, and timers.
extracted-snippets/community/snippets/Evp/fortnite-trigger-a-barrier-with-a-time-limit/01-snippet.verse
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.