> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PartyManager::DestroyLocalUser

> Starts an asynchronous operation to destroy a local user.

Starts an asynchronous operation to destroy a local user.

## Syntax

```cpp theme={null}
PartyError DestroyLocalUser(  
    const PartyLocalUser* localUser,  
    void* asyncIdentifier  
)  
```

### Parameters

**`localUser`**   [PartyLocalUser\*](/services/playfab/multiplayer/networking/reference/classes/PartyLocalUser/partylocaluser)

The local user to destroy.

**`asyncIdentifier`**   void\*\
*optional*

An optional, app-defined, pointer-sized context value that can be used to associate the completion state change with this call.

### Return value

PartyError

`c_partyErrorSuccess` if the operation to destroy the local user started or an error code otherwise. If this method fails, no related state changes will be generated. The human-readable form of the error code can be retrieved via [GetErrorMessage()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_geterrormessage).

## Remarks

This method queues an asynchronous operation to destroy a local user. A [PartyDestroyLocalUserCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partydestroylocalusercompletedstatechange) will be provided upon completion of the operation, indicating success or failure. Before successful completion of the operation, the local user will be removed from all networks it has authenticated into (each indicated by a [PartyLocalUserRemovedStateChange](/services/playfab/multiplayer/networking/reference/structs/partylocaluserremovedstatechange)) and any local chat control associated with the user will be destroyed (indicated by a [PartyChatControlDestroyedStateChange](/services/playfab/multiplayer/networking/reference/structs/partychatcontroldestroyedstatechange)). Memory for the local user will remain valid until all state changes referencing the local user have been returned to [PartyManager::FinishProcessingStateChanges()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_finishprocessingstatechanges).

## Requirements

**Header:** Party.h

## See also

[PartyManager](/services/playfab/multiplayer/networking/reference/classes/PartyManager/partymanager)\
[PartyDestroyLocalUserCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partydestroylocalusercompletedstatechange)\
[PartyChatControlDestroyedStateChange](/services/playfab/multiplayer/networking/reference/structs/partychatcontroldestroyedstatechange)\
[PartyLocalUserRemovedStateChange](/services/playfab/multiplayer/networking/reference/structs/partylocaluserremovedstatechange)\
[PartyManager::GetLocalUsers](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getlocalusers)


## Related topics

- [PartyManager::GetLocalUsers](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getlocalusers.md)
- [PartyManager::CreateLocalUser](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_createlocaluser.md)
- [PartyDestroyLocalUserCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partydestroylocalusercompletedstatechange.md)
- [PartyManager::CreateLocalUserWithEntityType](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_createlocaluserwithentitytype.md)
- [PartyLocalUserRemovedReason](/services/playfab/multiplayer/networking/reference/enums/partylocaluserremovedreason.md)
