> For the complete documentation index, see [llms.txt](https://ans-dev.gitbook.io/datareplicator/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ans-dev.gitbook.io/datareplicator/api-reference/server-side-api/delete.md).

# :Delete

Deletes a data entry on the server. This will also remove the key from the registry.

If any clients are currently listening to this `realKey`, they will be notified of the deletion. Their local cache for the key will be cleared, and their listener signal will fire with `nil`. Like updates, deletions are efficiently batched.

***

**`DataReplicator:Delete(realKey: string)`**

***

{% tabs %}
{% tab title="Parameters" %}

* `realKey`: [string](https://create.roblox.com/docs/luau/strings)

  The key of the data to delete.
  {% endtab %}

{% tab title="Returns" %}
[`boolean`](https://create.roblox.com/docs/luau/booleans) - `true` if the data was found and successfully deleted, or `false` if the key was invalid or did not exist.
{% endtab %}

{% tab title="Example" %}
{% code title="DeleteData.luau" %}

```lua
-- Example 1: Deleting a temporary event key after it has ended.
local EVENT_KEY = "Public_WeekendBonusXP"

-- (Some time later, after the event is over...)
local success = DataReplicator:Delete(EVENT_KEY)
if success then
	print(`[Server] Deleted event key: {EVENT_KEY}. Clients will be notified.`)
end


-- Example 2: Cleaning up a player's data when they leave the game.
local Players = game:GetService("Players")

Players.PlayerRemoving:Connect(function(player)
	local userId = player.UserId
	local playerDataKey = `PlayerData_{userId}`
	
	-- Delete their main data entry
	DataReplicator:Delete(playerDataKey)
	
	-- Also delete any other related data
	local playerSettingsKey = `PlayerSettings_{userId}`
	DataReplicator:Delete(playerSettingsKey)
	
	print(`[Server] Cleaned up all replicated data for player {userId}.`)
end)
```

{% endcode %}
{% endtab %}
{% endtabs %}
