QuickNetwork
QuickNetwork is an alternative, powerful and light wieght data store module to ProfileService and DataStore2. With features like SessionLocking, Backups and data combination, QuickNetwork provides an hybrid data store solution, also allowing you to control data saving and loading with easy flexibility.
Data loaded is auto saved automatically and managed efficiently with the least expensive of API calls, allowing you to use this module without worrying about data loss.
Documentation: Documentation
GitHub Source: GitHub Source
Roblox Model: Roblox Model
Benefits
-
Session Locking - Provides session locking, a powerful feature which prevents data duplication.
-
Robust Data Interface - Comes with its own data interface like DataStore2 except with no bloated methods, making it a hybrid combination of ProfileService and DataStore2.
-
Minimized DataStore API Calls - Proper data update detection and only sends an API request when needed, and takes precaution when working with API calls. Much securer than ProfileService and DataStore2.
-
Future Proof - Provides features for combining data from different keys or data stores all into 1, with the least expense of API calls. Also protects against throttling.
-
Light Weight - Doesn’t perform excessive API requests and conserves memory.
-
Flexibility - Easily handle data corruption and control how data is loaded / saved and other main aspects of this module, something which cannot be done when working with ProfileService or DataStore2. This allows for far more control, for advanced developers.
Want to get a new functionality recommended or issue a report? Head to Issues page in the repository and file one!
Example Usage
-- This is the template newly loaded datas' will default to
local DEFAULT_DATA_TEMPLATE = {
Cash = 5,
}
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local QuickNetwork = require(ServerStorage.QuickNetwork)
local DataNetwork = QuickNetwork.GetDataNetwork("DataNetwork", DEFAULT_DATA_TEMPLATE)
-- Handle data corruption:
DataNetwork.DataCorruptionLoadSignal:Connect(function()
-- Load backup data:
return "LoadBackup"
end)
-- Handle data load errors:
DataNetwork.DataErrorLoadSignal:Connect(function()
-- Load backup data:
return "LoadBackup"
end)
local function PlayerAdded(player)
local data = DataNetwork:LoadDataAsync(player.UserId)
-- Fill in any missing variables from the default data template:
data:Reconcile()
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Value = data.Cash
cash.Parent = leaderstats
-- Listen to when the data updates
data.ListenToUpdate:Connect(function(key, value)
if leaderstats:FindFirstChild(key) then
leaderstats[key].Value = value
end
end)
leaderstats.Parent = player
-- Increment cash:
data:Set("Cash", data.Cash + 10)
end
local function PlayerRemoving(player)
local data = DataNetwork:GetCachedData(player.UserId)
if data then
data:Clear()
end
end
-- Get new players:
Players.PlayerAdded:Connect(PlayerAdded)
-- Get current players:
for _, player in ipairs(Players:GetPlayers()) do
coroutine.wrap(PlayerAdded)(player)
end
-- Get leaving players:
Players.PlayerRemoving:Connect(PlayerRemoving)