OUTDATED:
What is BetterDataStores?
BetterDataStores is my latest open-sourced model for any developer to be able to use to allow for easy and impressive data saving without require programming! Using this model, you can simply add a value and the game will already understand what to do.
Get the model here: https://create.roblox.com/store/asset/91438623590909/BetterDataStores-V1
Play the demo showcasing this here (UNCOPYLOCKED): EasyDataStores Demo - Roblox
How to use:
First Opening: When you first open the model you will see a tutorial script which will also allow for reparenting everything required encase you forget or don’t want to. If you do want to then you simply put the DataStores script in ServerScriptService. Then in the DataStores script you will notice a few folders…
What’s PublicPlayerData? PublicPlayerData is just another name for values that can be viewed in leaderstats. You can simply add values here and when you play the game, it will appear and save the contents of the values. (PublicPlayerData can ONLY contain values. Attempting to put anything else will return warnings and not appear)
Remember that when dealing with DataStores, you must update values though a server script. The refrence for a value in PublicPlayerData is shown below
(PlayerName/LocalPlayer).leaderstats.(ValueName).Value
What’s HiddenPlayerData? HiddenPlayerData is sets of either veriables or folders/tables of data this is not visible in the leaderstats. This means that this is good for saving internal player data like what they have equipped or whatever you need it for. (HiddenPlayerData can have both values and folders to save data but if it is not a value or folder then warnings will return, More infomation on saving folders further down)
Remember that when dealing with DataStores, you must update values though a server script. The refrence for a value in HiddenPlayerData is shown below
(PlayerName/LocalPlayer).(ValueName).Value
How do I set a default value? You can simply do this by adjusting the value of the data you want to have a custom default value for. Couldn’t be simpler
[NEW] Folder/Table Saving:
This part is a little more advanced and currently considered to be a BETA feature meaning that some things are expected to not work as I continue to improve this section. Please give me feedback below as I continue to work on this! (Currently, this feature is functional)
Before learning about how to do this, Please remember the following:
- This feature is in BETA with some things not currently set up to work, Please keep on the lookout for updates revolving this!
- Folder/Table Saving is ONLY available for HiddenPlayerData to prevent unexpected behaviour.
- Using this is a lot more advanced and tricky for me to programme due to Roblox Lua not supporting code that I need it to support
- When you’re adding or removing instances for a Folder/Table save, You must do it via a Server Script.
- Folders cannot be named ‘leaderstats’, ‘StarterGear’, ‘PlayerGui’, ‘PlayerScripts’ or ‘Backpack’ to avoid the script getting confused.
Using this feature, you can easily create systems such as an inventory. To do this, simply add a folder to HiddenPlayerData and via server scripts you can add and remove instances so that when a player leaves and rejoins… Its there! You’ll even notice that anything parented to that instance will also save with it
Limitations: While any instance is eligible to be saved though this way, Please note that currently only specific built-in properties will save. These are Position, Size, Color, Text, Image, TextColor3, Transparency and Value. This has been done due to Lua complications in easily retrieving all properties.
Workarounds to limitations: As a work around while I continue to update this feature, You can use attributes which will all also be saved and from there you can use that infomation as you like including to set built-in properties. Once again sorry that this part is a little more complex.
Whats to come with this?
- Improvements to Folder/Table saving including more saveable priorities and reducing issues where needed
- Constently looking for feedback to implement. You can submit feedback here!
- More customisable settings to have better control over savings including saving player Backpack directly from a setting
Hopefully you enjoy using this model for your own projects. I wanted to create something that would benefit developers of all types from beginners to more advanced and hopefully you can easily benifit from this. Please report any problems and feedback below.
Get the model here: https://create.roblox.com/store/asset/91438623590909/BetterDataStores-V1
Play the demo showcasing this here (UNCOPYLOCKED): EasyDataStores Demo - Roblox
Current Version: 2
Last Updated: 26th October 2024