Save your player data with ProfileService! (DataStore Module)

Hey, I used one of y’alls samples and the listentorelease is kicking the player. I’m new to ProfileService, what does this mean?

function metaData:add(player, tester)
    local profile = profileservice:LoadProfileAsync("Player_" .. player.UserId)
	if profile ~= nil then
		profile:AddUserId(player.UserId);
		profile:Reconcile()
		profile:ListenToRelease(function()
			player:Kick("listentorelease")
		end)
		if player:IsDescendantOf(game.Players) then
			data[player] = profile;
		else
			profile:Release();
		end
	else
		player:Kick("not nil")
	end
	
	return data[player].Data;
end```

Whats the maximum load time when NOT using :ListenToHopReady()? Im considering sacrificing faster load times for teleport failure handling.

Before teleporting, you release the profile and call :ListenToHopReady(), and then teleport. But if the teleport fails, you are stuck with a released profile. Loading the profile again after every teleport failure doesnt seem like a good idea.

So I wanted to just remove the part where the profile gets released and listens to hop ready, and just teleport immediately, leaving the PlayerRemoved connection to release the profile.

Why not just making it retry the teleport if the teleport fails?

I guess thats a good point, but I dont think its that simple.

I didnt mention it in my original reply, but my game has a server list, so you can pick which server you want to join. What if the server is full and you try to join? It would just keep infinitely retrying. Or what if the server shuts down by the time you try to join it?

So Ive done some testing.

I removed the :ListenToHopReady(), removed the part that released the profile before teleporting, and set the profile data to random numbers while it was active.

When teleporting, it took no longer than 3 seconds to load the profile, and it seems to load your data correctly as well.

So it seems like this is safe to do, but I dont know what would happen on a larger scale though, with more players.

Is it alright if I save their data into their profile table right when they leave? This might be unreliable or whatever but it worked perfect when my game peaked 2k players and now when I average around 500-600.

Still waiting on any type of support to this since it’s stated profileservice could be a guild profile manager.

Can someone actually show something made with this?

2 Likes

My experience makes extensive use of both ProfileService and ReplicaService. I haven’t had a ton of concurrent users yet, but ProfileService has made working with datastores easy and painless. Highly recommended!

I quoted the specific part of using it for group oriented things which is what I’d like to see someone make an example of.

Im having a failrate (over 60s loadtime) for at a minimum 1 in 10,000 playerjoins.
Im using

Profile Manager:



function ProfileManager:Get(player)
	local profile = Profiles[player]

	if profile then
		return profile.Data
	else
		return nil
	end
end

default implementation provided by loleris
ProfileService is a version taken from 3 months ago (maybe the Sep. 10 update from the model, but I just got the Sep. 30 update from Github, I’ll see how it goes)

This issue is ongoing. This is the point of failure (reading data, and retrying until not nil)


How can I set up readings to diagnose the point of failure in ProfileService?
I have analytics.

1 Like


explain this and idk what to do

Roblox currently maintains DataStore key versions up to 30 days

2 Likes

Yo, i wanna make a Auction House system but is ProfileService and Update features is a good thing to use (i don’t know if the 6 sec cooldown of set methods on datastore would be great) or should i use MemoryStoreService ?

Yeah uh that’s not really like a flex, their examples suck.

Wait, is the profile needed to be locked in this stage? If you’re just showing like coins that won’t change or anything you might be able to use :ViewProfileAsync (if that exists which I remember it doing)

My imagination says your game is a game on which there’s a little lobby which lets you choose a server to join and might show things like stats even if those can’t be modified in that lobby. The worse thing that could happen by using ViewProfile would be players being temporality that they don’t have something even though they do, the profile just didn’t release / save until that data was in there.

I have a little issue @loleris, I’m trying to use GlobalUpdates:ChangeActiveUpdate() but with this function it requires the update_id of the ActiveUpdate and to get the ID you have to use GlobalUpdates:GetActiveUpdates() which also requires the player to be online. The only reason I’m using ChangeActiveUpdate() is to modify an offline user ActiveUpdate. Is there an alternative method to getting the ActiveUpdate ID’s?

Inside the ProfileStore:GlobalUpdateProfileAsync() function that you pass as an argument both GlobalUpdates:ChangeActiveUpdate() and GlobalUpdates:GetActiveUpdates() can be called freely regardless of whether the profile is active in a server or not - These methods are available for the GlobalUpdates object passed as the only argument to the callback function
image

2 Likes

Correct. However, some stats still do change, like daily rewards and such.

Hi, I was wondering if you can do:

require(5331689994)

Will this work?