# Source URL: https://dev.epicgames.com/community/snippets/XgPw/fortnite-player-leaved-helper
# Local doc: epic-docs/community/snippets/XgPw/fortnite-player-leaved-helper.md
# プレイヤーが抜けた際に関数が終了する
(CreativeObject:creative_object_interface).AwaitPlayerLeaved(InPlayer:player)<suspends>:void=
loop:
LeavedPlayer := CreativeObject.GetPlayspace().PlayerRemovedEvent().Await()
if(InPlayer = LeavedPlayer):
break
# プレイヤーが抜けた際にFuncが終了する
(CreativeObject:creative_object_interface).RacePlayerRemoved(InPlayer:player, Args:args, Func:type{_(:args)<suspends>:void} where args:type)<suspends>:void=
race:
CreativeObject.AwaitPlayerLeaved(InPlayer)
Func(Args)
# プレイヤーが抜けた際にFuncが実行される
(CreativeObject:creative_object_interface).DeferPlayerRemoved(InPlayer:player, Args:args, Func:type{_(:args):void} where args:type)<suspends>:void=
CreativeObject.AwaitPlayerLeaved(InPlayer)
Func(Args)
Expand code Copy full snippet(17 lines long)
* ```
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
AgentToMessage<localizes>(Agent:agent):message="{Agent}"
leave_test_device<public> := class(creative_device):
var PlayersInIsland : []player = array{}
OnBegin<override>()<suspends>:void=
Verse Library
verse
01 Snippet
Provides utility functions to detect when specific players leave, enabling deferred or racing logic tied to player disconnects.
extracted-snippets/community/snippets/XgPw/fortnite-player-leaved-helper/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.