Save your player data with ProfileService! (DataStore Module)

Is there any way you can restore player data in the case of a developer screw up? One bug leaking through can cause all the players to lose their data if they join the update before it is patched. I have testers, but sometimes you don’t see these bugs.

		Quests = {

reconcile doesnt work for tables, when I originally added the Quests table, it has Kills0/10, but after adding deliveries after, it doesnt appear in the table for players, any help?

what happens when I print the quests table (7/40 is supposed to be there):

How about you implement messagingservice, cross server messaging, it’d be cool! also that’s a new feature.

why? saving data is global
when you save to a datastore itll update everywhere

While this module is frikin amazing I have encountered on one of the issues which sorta gave me anxiety. I really appreciate your work but sometimes the ListenToHopReady is unreliable, most of the times testers have lost data, while I removed it the the data loss vanished completely at the cost of loading into battle place being longer.

You don’t necessarily need it, just call some function you’d wanna connect to a profile update where you’re updating the data.

What is “Profile Update”? I’ve searched the Profile Service API but couldn’t find the connection function for what you said so if you’re kind enough can you tell me what exactly this is?

Is there support for easily setting this up for external data stores ?

It’s not in the API of ProfileService. You have to create your own function that updates the data of your profile and your own signal that you fire in said function.

function setData(profile, key, value)
    local oldValue = profile.Data[key]
    --Checks if type of newValue is the same as oldValue for safety such as adding currency but you put in a string as an argument when the currency is an integer.
    if typeof(value) ~= typeof(oldValue) then return end

    profile.Data[key] = value
    --Assume that you have a custom signal and fire it

ProfileService has been a huge help but one thing I’m really used to with datastores is having folder instances to store player data rather than a table because I just think it’s way easier. Is this possible to do with ProfileService in a safe way where I wouldn’t be contributing towards data loss?

When you get profiles in your script you can just make instances with it with a for loop

ListenToHopReady does not change any data and it listens to a profile being released as well so…

They already have some sort of “messaging service”, its called global updates

is there a way to do backups ? or rolebacks

1 Like

also i love this module,
but im supper confused in how to store the players data i followed the tutorials on top

i am working on a rpg game so players gonna have tons of items
and i store the item id and nescessary stats and estimating with allot margin that a single non stackable item slot would be around 1000 Bytes or 0.001 MB if my math was not wrong if i reserverd 50% of the key size i still have arround 2 Trillion slots to save potentialy 2 000 000 000
but when i test this in practice i only get to 13 000 items and it exceeds the 4MB max save limit of roblox in a key am i doing somthing wrong here i thought i could store waaaaay more then this ?

any ideas or fixes i could do to increase max items i only store needed data

playerData = {
	loginTimes = 0,
	playTime = 0,
	deaths = 0,
	kills = 0,
	itemsLooted = 0,
	rank = {},
	memberShip = {},
	penalty = {},
	flags = {},
	quests = {},
	coins = math.random(1,100000000),
	gems = 0,
	titles = {1},
	equipedTitle = 1,
	companion = {},
	config = {["renderDistance"]=5},
	-- stats {lvl,xp}
	lvl_main = {1,0},
	lvl_attack = {1,0},
	lvl_strength = {1,0},
	lvl_defense = {1,0},
	lvl_ranged = {1,0},
	lvl_prayer ={1,0},
	lvl_magic = {1,0},
	lvl_vitality = {1,0},
	lvl_crafting = {1,0},
	lvl_mining = {1,0},
	lvl_smithing = {1,0},
	lvl_fishing = {1,0},
	lvl_cooking = {1,0},
	lvl_firemaking = {1,0},
	lvl_woodcutting = {1,0},
	lvl_runecrafting = {1,0},
	lvl_dungeoneering = {1,0},
	lvl_fletching = {1,0},
	lvl_agility = {1,0},
	lvl_herblore = {1,0},
	lvl_thieving = {1,0},
	lvl_slayer = {1,0},
	lvl_farming = {1,0},
	lvl_construction = {1,0},
	lvl_hunter = {1,0},
	lvl_summoning = {1,0},
	--equipment order = id , type , amount/nil , float , equiped , args
	--				1=	1,helmet,nil(nostackable),0.123
	--				2=	1,recource,50(stackable),nil(nofloat)
	equipment = {


i just wanna know if i can do anithing to get atleast 1 million item slots somehow or not
i mean there are many simulator games with inf inventory space (i know its not unstackables) is there a way ot do i just have to live with the 13 k and just optimize it more ?

ps i know stackables are only one slot with an ammount number i can’t do that for equipment as there unique with a random FLOAT and possible unusual or material variant
sorry for long messy post

I can highly recommend this module to everyone. It takes on a difficult task and solves it without any problems. Not even the examples of Roblox to Datastores work as reliably as this module.
I will definitely use it for all my future games.

Thank you @loleris for creating this exiting module! :pray:

Hello I have a question. When ever I add a new value I want to save in my profilestore it never adds it to the player’s data when returning it.

local ProfileStore = ProfileService.GetProfileStore(

    -- The data this store saves
        Cash = 0,
        Cars = {}

I added a new value called Cash and when I print the player’s data returned

it prints this

     Cars = {}

it does not list the Cash

How would I fix this.

You have to use reconcile on it.

I have multiple Profiles in my experience, however when I teleport, it releases the Profile, resulting in the primary


to trigger. I want to use


to make sure that data doesn’t take more than 7 seconds to load when hopping between places.

Is it ok if I remove ListenToRelease from the PlayerAdded function?

local ProfileService = require(game:GetService("ServerScriptService").ProfileService)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local Name = "Characters"

local DefaultProfile = {}

local ProfileStore = ProfileService.GetProfileStore("OwnedCharacters", DefaultProfile)

local Profiles = {}

	local Profile = ProfileStore:LoadProfileAsync("Player_"..Player.UserId)
	if Profile then
			Profile[Player] = nil
			Player:Kick("/n Error Code 1: /n /n Data loaded from another server. Please close Roblox and try again.")
		if Player:IsDescendantOf(Players) then
			Profiles[Player] = Profile
			local Data ="Folder")
			Data.Name = Name
			Data.Parent = Player
			local function Save()
				local DataForProfile = {}

				for _, Character in pairs(Data:GetChildren()) do
					local Skins = {}
					for Skin, Value in pairs(Character:GetAttributes()) do
						Skins[Skin] = Value
					DataForProfile[Character.Name] = Skins
				print("Ready to upload")
				Profile.Data = DataForProfile

			for DataType, Value in pairs(Profile.Data) do
				local Character ="BinaryStringValue")
				Character.Name = DataType
				Character.Parent = Data
				for CharacterSkin, Value in pairs(Value) do
					Character:SetAttribute(CharacterSkin, Value)

	local Profile = Profiles[Player]
	if Profile then
			local Released = Player:WaitForChild("Released")
			local Value ="BinaryStringValue")
			Value.Name = Name
			Value.Parent = Released

	local Profile = Profiles[Player]
	if Profile then