Player not in datamodel (Player:IsInGroup error)

game.Players.PlayerAdded:Connect(function(player)
     --- Some DataStore2:Gets & Instances creation
     --- "Benefits" is also created here and parented to the player so it definitely exists on the check below
     if player and not player:FindFirstChild("Benefits"):FindFirstChild("StarCreator") and player:IsInGroup(4199740) then
              --- Code Here
     end
      --- Many other if-then checks
end)

And the error is: Server: Player:IsInGroup error: Player not in datamodel (I could fetch it from GameAnalytics as I can’t seem to reproduce the error myself, it just happens and gets reported as an error)
The error only triggers sometimes, and it prevents other checks that take place after this if -- then. The code is in a script located in the ServerScriptService.
I have looked for the error on the DevForum but it seems it has just been a typo for most of the problems, but I don’t see any typo in my code.

I could probably use a pcall to solve it probably, but it’s always a better idea to find a fix instead of using a pcall I suppose.

2 Likes

I am currently having the same error, have you found a fix to this?

Try adding a wait() before the if statement.

I’m not 100% positive but I think this is the sort of thing you use “player:WaitForChild(“Benefits”)” instead of FindFirstChild as the error you’re receiving seems to be related to things not being fully loaded yet.