Save your player data with ProfileService! (DataStore Module)

Awesome! Glad to hear it’s working well for you. I will definitely give it a try!

Hello
Is there a way to disable BindToClose when testing in Studio?
Sometimes when stopping the game, the Studio becomes slow and a message is shown in Output - “Not running script because past shutdown deadline”

Thanks

remove the BindToClose function when you’re testing in studio

Do you mean to modify the code of the ProfileService module and comment it in it?

comment bind to close function in the script, not the profileservice module

I am not calling BindToClose explicitly. It is done internally by ProfileService

Do CTRL+F to find BindToCose and comment the code out.

1 Like

instead of using two profiles, you should just have your player data separated in multiple tables within your profile data.

Profile.Data = {
alphaData = {…},
releaseData = {…},
}

1 Like

How can I check if a certain profile’s data changes in the Server? ListenToChange only works on the Client.

Not a fan of storing versions of save data all in the same place. Imagine I have to roll the save data back numerous times due to major changes or breaks in the save data structure. That would be a nightmare having 10+ versions of the save data in the data table. The per-key data limit is set to 4MB which is quite a lot but I can see it reaching that quickly if I just store every version in the data table, especially with the plans I have with the inventory system, bank system, etc. I have to store a lot of data so the version tables are a no-go. It’s either 2 profiles or a versioning system using metadata to wipe the table if it’s an older version and reconcile with the new data.

Why not just add this code to the start of the BindToCose function?

if game:GetService("RunService"):IsStudio() then return end
1 Like

You should probably use GetService, but yes, it’s more efficient.

1 Like

I’ve been exploring the API of this module, which I currently use in my game, however I was wondering if it would be suitable for a gangs/factions system whereby users can create, view and edit data about their faction. I saw that profiles can be detached from players however I am a bit unsure on how to go about this, so any suggestions would be deeply appreciated.

3 Likes

I’ve asked that before but unfortunately got no assistance with it.

How do you remove a bit of the table of the saved data? I was testing stuff by adding different save things and now I would like to delete them.

Yo i don’t know if ProfileService is efficient on clan/faction system,i would use MemoryStoreService instead but imagine you want to use ProfileService.
So for adding,remove people from the faction I would get the clan profile or send a global update . And to handle Update I will make a loop for every player to get the profile and then release it instant or something like that

using mock profiles are good u just need to do

profile.Data.TestKey = nil

:slight_smile:

Successfully loaded sponsorship data, but failed to load time data. Any solution?

Memory stores are not the right thing to use for this type of case.

Correct me if I am wrong but I didn’t even use ReplicaService to replicate the data but it still works?

Server:

function module:UpdateCash(player, amount)
	local profile = self:GetProfile(player)
	if profile then
		profile.Data.Cash += amount
		player.leaderstats:WaitForChild("Cash").Value = profile.Data.Cash
		ReplicatedStorage.SendCashData:FireClient(player, profile.Data) -- sending data here through remote event
	end
end

Client

local ReplicatedStorage = game:GetService("ReplicatedStorage")

ReplicatedStorage:WaitForChild("SendCashData").OnClientEvent:Connect(function(cash)
	print(cash)
end)