Save your player data with ProfileService! (DataStore Module)

What happens if a profile fails to load its associated data due to a failed DataStore call on :LoadProfileAsync()? Does ProfileService have retries? If not (or if all retries also fail), does :LoadProfileAsync() just return nil, or does it return a profile flagged as a backup (using default data) and thus will never attempt to write that data to the actual DataStore like DataStore2?

From my understanding of the source code, LoadProfileAsync will retry indefinitely until the DataStore call succeeds. Is this correct?

I keep getting *error-type* whenever requiring the Service, and it doesnt run at all when playing, studio and actual game.

Is it possible to store an object (instance created by a class) into profile ?
If not how is it possible to serialize it since its actually auto saving ? it seem like it would be quite messy to do it

Roblox DataStore do not support object to be saved on it.
Just Save the data needed to recreate this object

Could also just edit the HTML tag on Body called
data-md-color-primary to be value slate

1 Like

Just notify you (don’t know if tou have to change something in your module or idk)

1 Like

But when to recreate this object since the purpose of profileservice is to have data always safe in profile ? It seem impossible to do it with an oop way, if i save the data of the object only then it feel like iam simply using a module script right? thats seem like its not worth the hassle to make a simily oop with this

I seem to be losing data everytime the server is shutting down, disconnected, or ROBLOX kicks them out. It works fine when they leave themself, but not on those events. Any idea?

I’ve been having this issue for the past 2-3 days. My API services are enabled and I am unsure what the problem could be. Is it on ROBLOX’s end or could it be my code? What’s more probable?

1 Like

Nothing really important most of the times it just means that auto save failed

1 Like

I’m also getting an issue with ProfileService error: “ServerScriptService.Data.ProfileService:1755: [ProfileService]: Profile [Store:“Store Key Here”;Key:“UserId Here”] is already loaded in this session”

This player left and joined after a minute.

1 Like

Good questions. I’m currently debuging the code as from time to time a profile won’t load (and I’m pretty sure that it was not due to teleport, not releasing, or other things mentioned in the tutorial and troubleshooting pages).

What I’m seeing is that it won’t retry but it might be that I’m not passing the correct parameters to have it retry automaticaly.

I read the source code and from my understanding, it will retry indefinitely if the reason for it not loading the profile is because of DataStore errors. In my game, I just have it so that it displays a loading screen until the profile has been successfully loaded and all the data that needs to replicated to the client is. You can always make it so that if it retries for too long (probably >60 seconds), kick the player if you want.

I’ve never had it not load a profile. I don’t use teleporting or anything like that so that probably helps me.

The loading screen is a great idea and I’m going to try it now.

1 Like

How would i be able to set different values like boolvalues and stuff? Because this always gives me a warning.

local ProfileTemplate = {
	Credits = 0,
	Wins = 0,
    Level = 0,
    XP = 0,
	Skins = {},
	visualUI = true,
	gameSFX = true,
	throw = Enum.KeyCode.E,
	inspect = Enum.KeyCode.G,
}

image

You can’t save an enum.
I would save “E” and “G” as strings instead. Then you can do InputObject.KeyCode to compare it against the strings.

1 Like

that’s an solution, anyways how would i retrieve data info from the client? cause that also gives me errors.

Depends on your usecase, but I would suggest you make a post in #help-and-feedback:scripting-support, since that’s not necessarily related to ProfileService.

You can probably use a RemoteEvent.

I’m having issues dealing with DDoS attacks. When the server crashes it doesn’t seem to be releasing the profiles and makes it unable to load data in other servers. What should I do?

1 Like

I don’t think there is much you can do, I would just ask DevRel to whitelist your servers

2 Likes