MadStudioRoblox / ProfileService

Universal session-locked savable table API
https://madstudioroblox.github.io/ProfileService/
Apache License 2.0
292 stars 157 forks source link

LoadProfileAsync yielding forever #7

Closed jakebball closed 3 years ago

jakebball commented 3 years ago

I currently am using profile service for a simple clicker game of mine and am using your dev forum example. It works fine until I attempt to load a profile with A mock store of LoadProfileAsync() but it yields the code forever. Here is the on playerAdded function. The game prints "is safe" just fine but doesnt print "loaded profile" at all. I am in the OSS discord with the tag of jakebball11#3826 if you would prefer contacting me there.

  if isDataStoreSafe then
        print("is safe")
        local profile = GameProfileStore:LoadProfileAsync("PlayerId_"..player.UserId, "ForceLoad")
        print("loaded profile")
        if profile ~= nil then
            if loadedProfiles[player.UserId] == nil then
                loadedProfiles[player.UserId] = true
                profile:Reconcile()
                profile:ListenToRelease(function()
                    player:Kick("issue with loading your data, please try again later")
                    SessionProfiles[player.UserId] = nil
                end)

                if player:IsDescendantOf(Players) then
                    --assign a key in session data that is a reference to the players profile
                    SessionProfiles[player.UserId] = profile
                    loadObjectValues(player)
                    loadGamepasses(player)
                    Moderation.playerLoaded(player)
                    if RunService:IsStudio() == false then
                        player.Character:WaitForChild("Humanoid").WalkSpeed = GemShopInfo.WalkSpeedLevel[DataController.getData(player, "WalkSpeedLevel", "PrivateStats")].speedAmount
                    end
                    RemoteEvents.PlayerFinishedLoading:FireClient(player)
                    if RunService:IsStudio() then
                        for _=0,3,1 do
                            DataController.givePet(player, "Bear")
                        end
                    end
                else
                profile:Release() 
                end
            end
        else
            player:Kick("issue with loading your data, please try again later")
        end
    else
        player:Kick("There was an issue loading your data, please try again")
    end