What Is It
It’s a ProfileService and ReplicaService implemtation that tries to get common player data things done quick. It hides typical ProfileService/ReplicaService logic and it comes with a bunch of boiler plate code so you don’t have to manually set everything up. It’s pretty much the instant oatmeal of player data solutions. I was going to make this library have more QoL features, be easier to read, and have bigger and better error handling but I don’t feel like working on it anymore. Because of this there’s incomplete features, minimal explanation, and probably bugs.
Main features
- Customize how your data can be modified
- Set up global leaderboards quick
- Add dev products without having to mess with logic in case it fails.
Demos
Setting up data
Padlib.RcParams.DATA_TEMPLATE = {
-- quick set up
height=1,
-- specific set up, leaving fields empty sets it to default values
level = {
value=1,
-- this is in form {min, max} but it can be a like {option1, op2, op3}
constraints={1,100},
validate = function(player, newValue)
local cur = PlayerData.new(player).get("level")
return newValue - cur <= 1
end,
save=false, -- resets on join
clientModifiable=false, -- can't be modified via RE
leaderstat=true, -- will show up as a leaderstat
},
}
Quick global leaderboard setup
local gb = Gboard.new("LevelLeaderboard")
-- when a player leaves, save their level from playerdata
gb.bindToPlayerData("level")
-- get the information already in the leaderboard
for ranking, info in ipairs(gb.getRankingsAsync()) do
local userName = info.userName
local val = info.value
-- add it to a gui object
end
Quick devproduct setup
Util.addDevProduct(10919201, function(player)
PlayerData.new(player).incrementData("level", 10)
end)
Level up implementation
PlayerData.addDataChangeListener(function(player)
local pd = PlayerData.new(player)
local data = pd.getData()
while data.xp >= data.level * 10 do
pd.increment("level", 1)
pd.increment("xp", -data.level * 10)
end
end)
Reading data from client
PadClient.onDataReceived(function(data))
Usage
All modifications should be done in the SSS files called “RunConfigure” and “GameRoot”.
In RunConfigure, you should change all the settings to your liking and add any listeners (devproducts datachange listeners). In GameRoot you can change what “saveslot” the player will use once they’re loaded and what happens when their character is loaded in.
Links
Roblox Model
Uncopylocked Example Place
Wiki
GitHub Repository
Closing
Check out the place if you want to see an implementation. If you want anything changed about this or there’s bugs lmk. Feel free to contribute to the github repo or wiki if you really like this.