Introduction
Hello everyone, I’m making this post to talk about a library that I’ve recently written. At the end of last year, I wrote a library called “ProStore” which was supposed to be a very simple alternative to DataStore2 that handled almost every single detail for you and allowed you to manage data at a very high level.
However, that library had a lot of tiny issues and limitations and instead of making it even messier with a fix attempt, I decided to make a new one now 8 months later which fixes all the bad aspects of the last one.
Basic concept
This is supposed to be a super simplified version of the DataStore, all you have to do is drag and drop the ProStore file to wherever you want and it will instantly work (handles all events from player joining to player leaving)! I would personally recommend putting this in ServerScriptService to avoid access to it directly from the client cause you know, exploiters. You don’t even need to manually make a logic for your data, just open the “Settings” file and edit the schema.
Lifecycle
Player joins the game →
ProStore grabs the player and loads his data →
ProStore calls the “PlayerAdded” methods assigned by the developer →
ProStore stores the online players in a socket that can be accessed by the developer →
Once the player leaves it will save the player and remove him from the socket
Features
-
Auto-save, you can adjust it to as often as you’d like
-
Dynamic database schema, you can change any variable type, add or remove one and the data of the players will be correctly updated to the newly changed schema without losing any data.
-
Handles events such as player joined and left for you making you barely need to worry about how to implement DataStores
-
Supports nested Gets and Sets, example:
--[[
Assuming the schema looks something like this:
schema = {
Coins = 0,
stats = {
health = 100
}
}
]]
--Getting nested variables is easy, all you have to do is add a "." between each index name as in the example below
local playerHealth = ProStore2.Get(player, "stats.health")
print("Health: ", playerHealth)
To keep in mind
This is not a perfect solution for dataStores, it’s meant to be an easy and quick way of setting up a database for your game, if you want a bullet proof database I’d recommend getting your own server and use MySQL or MongoDB. If you want something fast and free to setup your game database then feel free to use this!
Example
This is a very basic level example of how easy it is to use this library
--Services||
local ServerScriptService = game:GetService("ServerScriptService")
----------||
--Dependencies||
local ProStore2 = require(ServerScriptService.ProStoreV2)
--------------||
local function playerJoined(player, playerData)
local playerCoins = playerData.Coins --Getting the coins directly from the playerData
local playerCoins2 = ProStore2.Get(player, "Coins") --Default way of getting them
local playerInstance = ProStore2.Set(player, "Coins", 100)
print(player.name.." now has "..playerInstance:Get("Coins").." coins!")
end
--Events||
ProStore2.PlayerAdded:Connect(playerJoined)
API
You can find all the details on how to use and install this library on its corresponding github.
prooheckcp/ProstoreV2: Prostore v2 (github.com)
I would suggest downloading it directly from here but I made it a Rojo project on GitHub in case you’d want that (I personally dislike hooking modules directly from GitHub)