Save your player data with ProfileService! (DataStore Module)

I don’t think using ProfileService would be useful for that

1 Like

There is a Save function in ProfileService, just call that when needed to, and also to remove the data saving on leaving remove the following line from Profile:Release() (this is me guessing but should work)

		task.spawn(SaveProfileAsync, self, true) -- Call save function in a new thread with release_from_session = true

I just figured out that to also remove auto saving just run this in the code somewhere and make sure it never runs the autosave function

	RemoveProfileFromAutoSave(profile)
1 Like

Thanks for the answer, I appreciate it!

1 Like

You’re going to want to use ordered date stores for this.

Would someone like to tell me what this Module does to fight duplication exploits/issues except for session locking?

1 Like

it technically prevents oldest dupe method, “multi-client”
which still works for datastores that has no session lock and save only after player leave

Thanks for the answer!

However, my question was if it does something except session locking (which prevents the :GetAsync() - :Set/UpdateAsync() race condition).

1 Like

i don’t really have that much information about it
but ProfileService also has GlobalUpdate to send data between servers and players
though i never use it
i have seen it being usefull
(Global Updates takes : Min 30 Seconds, Max 8 Mins to reach if i remember right)

1 Like

if i remember right, ProfileService and all others are just a More secure version of Datastore because of Mock Store and other Stuff

also They all may have different load speeds depending on the way it is implemented.

1 Like

If anyone has further information about this, a response would be appreciated.

is it a good choice for a game where each player has a folders with many values to save?, Example “Pets”

Could accessing profiles using multiple script simultaneously cause race condition issues?

Screenshot 2024-08-09 022257
I have just encountered this weird bug

Could someone help me out?

image

Does anyone know how to save tables I’m having problems saving them.

				if profile.Data and profile.Data.trucks and type(profile.Data.trucks) == "table" then
					for _, truck in ipairs(truckFolder:GetChildren()) do
						local truckName = truck.Name
						local truckValue = profile.Data.trucks[truckName]

						if truckValue ~= nil and type(truckValue) == "boolean" then
							truck.Value = truckValue
						end
					end
				end

the error message is blocked, also show me a snippet of the code where is it from

did you define self._view_model some where before?

do you want to save or load the data

I would approarch saving like this

for _, truck in ipairs(truckFolder:GetChildren()) do
    profile.Data.trucks[truck.Name] = truck.Value 
end

I would like to save data but it doesn’t want too.

Are you doing this on the server or the client?