Save your player data with ProfileService! (DataStore Module)

This actually inspired me to go research other tutorials of how people set up ProfileService. (To be specific @EncodedLua.)

His tutorial helped out a lot and I all seems to be working great. Can’t wait to tinker with it more!

1 Like

I’d love to see a data backup implementation with this. This is an awesome module!

I’ve been playing around with this module for a while and I have a follow up question.

I’m interested in the idea of creating a vender where you can add more to your currency, either coins or gems. The wiki for this module clearly states:

ProfileService is supposed to be a ModuleScript which you can place inside your Roblox game’s ServerScriptService or wherever else is preferred. ProfileService can only be used server-side

In a hypothetical scenario, what are the repercussions of me placing this module in ReplicatedStorage (rather than ServerScriptService) and attempting to require the module in this path to increase the client’s data? Should I resort to using remote events (and leave the module in the ServerScriptService)?

If so, how would I even approach this?

That sounds like you’re relying too much on the client, and you shouldn’t do that since exploiters would be able to modify their own data and cheat. All of the code for managing data should be on the server-side.

1 Like

How else can you wheel that information to the client without using a localscript? (Which is pretty much the only way since you can only use local scripts for textbuttons/guis and not serverscripts.)

You can send a RemoteEvent everytime a variable for the player changes, or use a ValueObject parented to the player, but if you use ValueObjects then exploiters can see other player’s data.

ReplicaService is the best way to do this though.

3 Likes

This module cannot be required on a client script as It relies on datastorservice and datastoreservice only works on a server script

1 Like

Is it possible to convert ProfileService data back to just normal datastores?

Like if I wanted to stop using ProfileService and wanted to convert back to how normally people save data.

Also I’m not switching, just wanted to know if there’s a way incase it was needed.

A rough way of doing this is storing the profile’s .Data when it is loaded, releasing it and clearing the profile, and then calling WipeProfileAsync on the datastore key. From there you can either overwrite the key in the same datastore or just transfer to a completely new one, and make a new key in it with the data you retrieved from the profile.

How frequent can I call GlobalUpdateProfileAsync before expecting any problems?

Hey, how can I save the add a value to another player in the script? :confused:

Trying to figure out how to use Reconcile() so whenever I update the saveStructure it’ll automatically fill in the missing values.

The wiki does not clarify enough and is pretty vague on how to “implement” it. I’ve been calling it after release but I’m not sure if I’m using it right.

if profile ~= nil then
	profile:ListenToRelease(function()
		cachedProfiles[player] = nil
		player:Kick("Profile has been loaded. Please rejoin.")
	end)
	
	if player:IsDescendantOf(Players) then
		cachedProfiles[player] = profile
		PlayerDataLoaded(player)
	else
		profile:Release()
		profile:Reconcile() --????
	end
else
	player:Kick("Unable to load saved data. Please rejoin.")
end
2 Likes

See the example code in the original post - Reconcile() is called as soon as a profile is loaded.

2 Likes

Hello, I am getting the issue of persistent but random 15 second load times of data between universe teleports. This happens less with 1-2 players, but more with 3+ so this issue was easier to try and reproduce for me.

I checked the documentation and it said to make sure that :Release() is being called, and I did, so I used Discord logs to see if they were ended up being released or not. Here are some screenshots:


I know this is most likely an issue with my code, just wondering if there are things that might cause this that I’m missing or doing wrong. Thank you!

1 Like

That was expected behaviour - try releasing before a teleport request.

ProfileService will wait until a profile is released by the last session and it could be the case that your teleports are racing the .PlayerRemoving triggered releases.

4 Likes

This almost seems too good to be true! I haven’t used it yet, but I’m exploring my Datastore options. Surely there’s a downside to this? I’ve been using Datastore2 for a while now, and data loss has been very minimal and even so - it would only revert back to a previous save of data loss were to occur.

How does Profile handle situations of data loss? How does it react to when Roblox is down and data stores cannot be accessed? How does it fair with games with multiple places that you teleport between in quick succession?

Is there a way to disable saving for testing purposes? I’d like to test any structural changes I make to my saved data without running the risk of a corrupt version being saved.

1 Like

im pretty sure there is a mock feature.

https://madstudioroblox.github.io/ProfileService/api/#profilestoremock

I’d like to load existing saved data. Mock can only load a new profile, not an existing one.

1 Like

you could possibly load in a mock and a live one and copy the live data to mock.