-
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.
-
What is the issue? Profiles are taking much too much time to load
-
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)