Save your player data with ProfileService! (DataStore Module)

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

1 Like

There’s no such thing as a ‘whitelist’ on servers.

Your roblox game servers are being ddosed? I made a solution what about this

edit: meant to specify on earlier post to find whitelisted servers

Wooow! I’m not super pro at roblox programming, i didn’t understand how to use data store, but this way is so easy to use! And also i was scared about data of some players will destroy sometimes, one of youtubers said that with this module script it will be fixed! Thank you so much, this helped me alot!

someone knows how can i change player data (using ProfileService) if player is not in game?

Use global updates to adjust their data when they rejoin.