ProfileService: Profiles taking too long to load

  1. What do you want to achieve? I’d like to reduce the time it takes for profiles to load via @loleris 's ProfileService datastore wrapper.

  2. What is the issue? Profiles are taking much too much time to load

  3. What solutions have you tried so far? I tried troubleshooting using this guide by loleris, but that didn’t seem to help. From using this guide, I know that my profile is being released immediately after leaving the game.

function DataService:SetupProfile(player: Player)
	local start_time = tick()
	local profile = ProfileStore:LoadProfileAsync("Player_" .. player.UserId)
	print(tick() - start_time) --> Takes approx 11-12 seconds
	if profile ~= nil then
		profile:AddUserId(player.UserId)
		profile:Reconcile()
		profile:ListenToRelease(function()
			self.Profiles[player] = nil
			player:Kick()
		end)
		if player:IsDescendantOf(Players) == true then
			self.Profiles[player] = profile
			profile.Data.LogInTimes += 1
			print(("%s Successfully loaded %s's data!"):format(self.Prefix, player.Name))
		else
			profile:Release()
			warn(("%s %s left before data could be loaded"):format(self.Prefix, player.Name))
		end
	else
		player:Kick()
		warn(("%s Couldn't load %s's data, kicking."):format(self.Prefix, player.Name))
	end
end
for _, player in ipairs(Players:GetPlayers()) do
	task.spawn(function()
		DataService:SetupProfile(player)
	end)
end

Players.PlayerAdded:Connect(function(player)
	DataService:SetupProfile(player)
end)

Players.PlayerRemoving:Connect(function(player)
    local profile = DataService.Profiles[player]
    if profile ~= nil then
        profile:Release()
        print(player.Name .. "'s profile has been released!") --prints immediately
    end
end)
1 Like

This might be a backend problem. I never used ProfileService nor tried it, for now just make a loading screen for this.

@loleris Do you think this could be caused by too many datastore requests? I’m switching a game over to ProfileService and it previously used a lot of vanilla datastores.

This error is happening to me too. Profile loading takes about 2-5 seconds from what I’ve tested… I’ve tried several things but most of the devforum answers are confusing, the solution I came up with was to use loop
I used repeat until and it worked but there is a problem, depending on what you do it will give errors and crash Roblox studio.