#ProfileService issue

16 messages · Page 1 of 1 (latest)

ebon lily
#

For some reason, ProfileService isn't loading the profile properly. I think that is happening because I changed the data template, but how would I fix this issue?

Script:

local dataTemplate = {
    Cash = 0,
    Level = 0,
    LogInTimes = 0
}

local ProfileService = require(game.ServerScriptService.Modules.Data.ProfileService)
local Players = game:GetService("Players")

local ProfileStore = ProfileService.GetProfileStore("PlayerData", dataTemplate)

local Profiles = {}

local function playerAdded(player)
    local profile = ProfileStore:LoadProfileAsync("Player_".. player.UserId)
    
    if profile then
        profile:AddUserId(player.UserId)
        profile:Reconcile()
        profile:ListenToRelease(function()
            Profiles[player] = nil
            player:Kick("a")
        end)
        
        if not player:IsDescendantOf(Players) then
            profile:Release()
        else
            Profiles[player] = profile
        end
    else
        player:Kick("b") --It's kicking the player here.
    end
end
near trenchBOT
#

studio** You are now Level 7! **studio

cyan wraith
ebon lily
#

What do you mean?

cyan wraith
#

what is the module you're using require() to

ebon lily
#

ProfileService

cyan wraith
#

no shit

#

what is the module contents

ebon lily
#

?

cyan wraith
#

game.ServerScriptService.Modules.Data.ProfileService

#

what is this thing's contents

#

how else am i gonna help

ebon lily
#

It's an open-source module

#
cyan wraith
#

have you seen how to use it properly in the forum post

ebon lily
#

Yes