I have made numerous topics on this issue before, like this one.
I have had no luck. I decided to put warn statements around me code (so they would be easy to find in Error Report under Monitoring), in and around the code that initializes the profile service stuff. I am even more confused.
The below is a screenshot from Error Report:
(ReplicatedStorage.profileServiceConnection pulls data from ServerScriptService.profileService.PlayerDataHandler which pulls the actual ProfileService stuff, it is a little screwy how that works but that setup is not the issue FYI)
As you can see, Line 154 in the leaderBoard script gets executed - but there is a line of code before that, that is supposed to serve as a ‘checkpoint’ to see how things are going - and that code is never fired before ProfileService gets initialized… Example:
if loadedFromLoop == true then
warn(Player.UserId.." was loaded from the for loop!")
else
warn(Player.UserId.." was loaded normally.!")
end
warn(Player.UserId.."'s Parent is "..tostring(Player.Parent))
psConnection:PlayerAdded(Player)
Sometimes, however, it does get fired and prints the above warn statements:
It seems like in the above scenario, the affected player joined and rejoined 5 times, the first times nothing worked, and the fifth and final time, ProfileService loaded correctly.
I have no idea why this happening. for the code that actually pulls data from ProfileService, this is that “playerAdded” function:
function PlayerDataHandler:playerAdded(player:Player)
local profile = ProfileStore:LoadProfileAsync("Player_"..player.UserId, "Steal")
if profile then
profile:AddUserId(player.UserId)
profile:Reconcile()
profile:ListenToRelease(function()
Profiles[player] = nil
player:Kick("To protect your data, you were kicked from the game.")
end)
if not player:IsDescendantOf(Players) then
profile:Release()
warn(player.UserId.." has not really loaded in yet...")
else
Profiles[player] = profile
if player:GetAttribute("initialized") ~= true then
player:SetAttribute("initialized",true)
else
warn(player.UserId.." has already been loaded in once before...")
end
end
else
player:Kick("There was an error loading your data, and for your protection, you were kicked from the game. Please try again!")
end
end
In the above code, if the code detects that the player was loaded already, it would detect that “initialized” attribute and warn about it. There is no instance of that happening, whatsoever.
I am very confused as to how this is even happening with ProfileService. I used a similar setup in a different game when I was actively working on it (I am no longer), and I did not have nearly a fraction of the issues I’ve had using ProfileService in this game.
Can anyone help me figure out what the hell is going on here???