> 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/getserverdata.md).

# :GetServerData

Retrieves data directly from the server's internal storage.

This function provides **immediate, synchronous access** to the current state of any replicated data. It is intended for **server-to-server communication only** and should not be used as a substitute for client communication.

***

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

***

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

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

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

{% tab title="Returns" %}
`any | nil` - The current data associated with the key, or `nil` if the key does not exist.
{% endtab %}

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

```lua
-- In a different server script, for example, a quest completion script.

local function onQuestCompleted(player, questId)
	local userId = player.UserId
	local playerDataKey = `PlayerData_{userId}`
	
	-- Retrieve the player's current data directly from DataReplicator's storage.
	local currentPlayerData = DataReplicator:GetServerData(playerDataKey)
	
	if currentPlayerData then
		-- Create a deep copy to modify
		local newPlayerData = HttpService:JSONDecode(HttpService:JSONEncode(currentPlayerData))
		
		-- Modify the data based on quest rewards
		newPlayerData.XP += 100
		newPlayerData.Gold += 50
		table.insert(newPlayerData.CompletedQuests, questId)
		
		-- Update the data in DataReplicator, which will then replicate the changes to the client.
		DataReplicator:Update(playerDataKey, newPlayerData, player)
		
		print(`[QuestSystem] Player {player.Name} completed quest {questId} and received rewards.`)
	else
		warn(`[QuestSystem] Could not find player data for {player.Name} to grant rewards.`)
	end
end
```

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