You are calling a yielding function inside of a players.PlayerRemoving event so it’s likely the player is removed and thus the server is shut down before the call can complete.
Btw I forgot to mention that the issue only happens after being in the game for 60 seconds or more.
Adding a game:BindToClose(function() fixes it so I added that to my main game, but now I’m getting Player:GetRankInGroup error: Player not in datamodel. Here’s my code:
Players.PlayerRemoving:Connect(function(Player)
print(3)
print(Player:GetRankInGroup(16616102))
if Player:GetRankInGroup(16616102) >= 70 then
print(3.5)
end
end)
3 prints and so does my rank but then Player:GetRankInGroup error: Player not in datamodel prints and nothing prints after that.
Fixed- the issue was that GetRoleInGroup and GetRankInGroup can’t be called when the player leaves the game. To counter this I had to store the player’s rank in a table when they join.