# Data Method's \[🔜]

{% hint style="danger" %}

## Feature unreleased

This feature will be releasing in Version 8 as phase 2 of the Data Loss Prevention action's to Simple Data Stores! The following is just a preview of what's to come
{% endhint %}

### What is Data Method's?

Data Method's are popular alternative method's of storing and retrieving player data. This is designed to be flexible with diffrent developers and project's data management needs on an internal developers end.

### What each option means

**Normal Storage Method:** Data types are stored inside of the player instance such as values and folders. This is the conventional method that is used in many projects and a standardised way of achieving player data storage for years! (When you add this to your project, this is the default setting)

**Tabled Data Storage Method:** Data types are stored within a module script of which is available within the DataMethods setting and can be moved anywhere in the game space where all scripts can view it. Here, you must use API function's to keep player data up to date, this is the most secure method!

**Attributed Data Storage Method:** Data types are stored in the player instence as attributes rather then as individual instance's. You'll need to use :GetAttribute() and :SetAttribute() instead of other method's for this storage method.

### Pro's and Con's

| CONTEXTS / SUBJECTS                                                           | Normal Storage Method                                                                                                                                                                                                           | Tabled Data Storage Method                                                                                                                                                                                                      | Attributed Data Storage Method                                                                                                                                                                                                             |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Good to prevent against hacker's                                              | <mark style="color:$danger;">**NO**</mark> <mark style="color:$danger;"></mark><mark style="color:$danger;">because it's easily accessible within the game space</mark>                                                         | <mark style="color:$success;">**YES**</mark> <mark style="color:$success;"></mark><mark style="color:$success;">because it's stored within a script</mark>                                                                      | <mark style="color:$warning;">**PARTLY**</mark> <mark style="color:$warning;"></mark><mark style="color:$warning;">because it's not immediately accessible to a hacker but might still be possible</mark>                                  |
| Is easier to work with                                                        | <mark style="color:$success;">**YES**</mark> <mark style="color:$success;"></mark><mark style="color:$success;">because it's the Roblox Engine / games development conventional way of storing and accessing player data</mark> | <mark style="color:$danger;">**NO**</mark> <mark style="color:$danger;"></mark><mark style="color:$danger;">because it requires the usage of Module Scripts which can be seen as a higher skill level requirement</mark>        | <mark style="color:$warning;">**PARTLY**</mark> <mark style="color:$warning;"></mark><mark style="color:$warning;">because although it can be accessed though the player instance it requires less conventional methods to do so</mark>    |
| Good for runtime preformance (for games with big and heavy data dependency's) | <mark style="color:$danger;">**NO**</mark> <mark style="color:$danger;"></mark><mark style="color:$danger;">because the more instances that the game needs to generate, the more memory cost is required</mark>                 | <mark style="color:$success;">**YES**</mark> <mark style="color:$success;"></mark><mark style="color:$success;">because this method requires no memory cost because it's not added to the gamespace but kept in a script</mark> | <mark style="color:$success;">YES because attributes are purpose built to be low on memory cost making them great for data</mark>                                                                                                          |
| Good for lower data dependency games                                          | <mark style="color:$success;">**YES**</mark> <mark style="color:$success;"></mark><mark style="color:$success;">because it's quick to access, easy to use and doesn't use so much memory cost</mark>                            | <mark style="color:$warning;">**PARTLY**</mark> <mark style="color:$warning;"></mark><mark style="color:$warning;">because it uses no memory cost but might be a bit complex</mark>                                             | <mark style="color:$success;">**YES**</mark> <mark style="color:$success;"></mark><mark style="color:$success;">because it uses very little memory cost and easy to access</mark>                                                          |
| Retrieval Method                                                              | <mark style="color:$success;">**EASY**</mark> <mark style="color:$success;"></mark><mark style="color:$success;">because it's in the ancestry of the Player Instance</mark>                                                     | <mark style="color:$danger;">**COMPLEX**</mark> <mark style="color:$danger;"></mark><mark style="color:$danger;">because you need to understand module scripts and Lua Tables</mark>                                            | <mark style="color:$success;">**EASY**</mark> <mark style="color:$success;"></mark><mark style="color:$success;">because the retrieval and setting of attribute's is similar to normal storage method and is just 1 simple function</mark> |

### When to use each method

**DISCLAIMERS:**

* Remember to never switch data methods once you've choosen once and started making a lot to do with the games player data manipulation and handling.
* Also remember that no method is the wrong method! All of these are suggested and people mostly choose each method for internal purposes rather then for the technological purposes and each one will still work very effectively to any project type.

#### Normal Storage Method

This method is perfect if...

* You are in experienced in either the Roblox Engine or Roblox programming
* You are making a game with little player data requirements (Less then 50 values approximately)
* Making a tech demo
* Need to be able to access the contents of folder's (such as all instance types within folders)
* Highly recommended for both Tycoon and Free-Form Creation game's due to easy access of which would need to be created and cost memory anyways and is highly needed as a core aspect of the game loop and game concept itself
* Do not use if you are dependent on Values a lot and the number of values needed are very high (instead, it might be better to use Attributed Data Storage)

#### Tabled Data Storage

This method is perfect if...

* You are more proficient in programming on Roblox (or just in general) and understand the fundamentals of Roblox Modules
* Your game has a lot of players per server
* Your game needs to be able to preform efficiently in memory cost (high end games that needs as much optimisations as possible to prevent to much lag)
* You want the maximum security against hacker's changing their player data
* You are making a game where you're more likely to access values rather then requiring instances
* Highly recommended for Simulators because of it's low memory cost and more dependency on getting values rather then instances/game obejcts
* Do not use if you are needing to have access to a lot of content saved in the player that will be displayed publicly in the gamespace anyways (instead, it might be better to use Normal Storage Method)

#### Attributed Data Storage

This method is perfect if...

* You are looking for something that can optimize your game's performance
* You don't have folders OR you are experienced in tables, arrays, jagged arrays and/or meta tables to understand how to retrieve and update this content
* Still want to use a similar and easy to use method to Normal Storage Method
* Highly recommended for horror, roleplay or general games that are value dependent rather then table dependent (Can still be used if you have some table dependency's but overall I would not recommend especially if you've got stuff like inventory's seperate to Backpack)
* Do not use if you are needing to have access to a lot of tabled content saved. If it needs to be publicly viewable within the game space then use Normal Storage Method BUT if it's used internally as information then use Tabled Data Storage

### How to enable

Because there is so many option's for this setting and no options value type, we've had to resort to a numerical way of letting you choose! Here is what each number in the number value does.

| Method                         | Number Value |
| ------------------------------ | ------------ |
| Normal Data Storage Method     | 0            |
| Tabled Data Storage Method     | 1            |
| Attributed Data Storage Method | 2            |

**REMEMBER:** if you input a value that isn't 0, 1 or 2 then the systems will default to Normal Data Storage Method. Internally in the code, as per the open-source MIT licence, you are allowed to modify the default method.
