> For the complete documentation index, see [llms.txt](https://docs.overdare.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.overdare.com/development/api-reference/classes/datastoreservice.md).

# DataStoreService

DataStoreService : `Instance`

## Overview

DataStoreService provides access to data storage in server environment.

## Properties

## Methods

### GetDataStore

Creates a new DataStore object based on the provided name and returns it. If it is called again with the same name, it reuses previously created instance.

#### Parameters

| `string` InName     | The name of a DataStore object.                                                                                                            |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `string` InScope    | A scope string used to distinguish keys within the DataStore. It can be left empty, and when provided, must be 50 characters or less.      |
| `Instance` InOption | An option instance used to specify additional behavior when creating the DataStore. If not specified, it is created with default settings. |

#### Return

| `GlobalDataStore` | The returned DataStore object. |
| ----------------- | ------------------------------ |

#### Code Samples

```lua
local DataStoreService = game:GetService("DataStoreService")
local GoldStore = DataStoreService:GetDataStore("PlayerGold")
```

### GetGlobalDataStore

Returns default global data store provided by system. The GetDataStore function must be used to access a separate data storage with a specific name.

#### Parameters

#### Return

| `GlobalDataStore` | The returned GlobalDataStore object. |
| ----------------- | ------------------------------------ |

#### Code Samples

```lua
local DataStoreService = game:GetService("DataStoreService")
local GlobalStore = DataStoreService:GlobalDataStore()
```

## Events

## See also

{% content-ref url="/pages/UhMJ4cZ06n5d2vzza3Pw" %}
[Saving & Loading Data](/manual/script-manual/advanced-gameplay-systems/datastore.md)
{% endcontent-ref %}
