basicially, I started using profileservice for my game and used this function from the docs
local function PlayerAdded(plr)
local profile = ProfileStore:LoadProfileAsync("NewPlayer_" .. player.UserId)
if profile ~= nil then
profile:AddUserId(plr.UserId)
profile:ListenToRelease(function()
Profiles[plr] = nil
plr:Kick()
end)
if plr:IsDescendantOf(game.Players) == true then
Profiles[plr] = profile
doStuff(plr, profile)
else
profile:Release()
end
else
plr:Kick()
end
end
the doStuff function creates leaderstats and loads them but the problem is it rarely wont run (probably like 1 in 30 players), shown below
i’ve tried looking for errors with even a logging system but it never errors, just doesnt run
Any help is appreciated, I’ve gotten constant complaints and people will basically immediately will leave (not kicked, by the way)