I have a script and the problem is that a player leaves before it finishes saving and so everything is returned nil because it can't find the player. I used BindToClose which I'm pretty sure is keeping the server from shutting down while saving, my plr variable are returning nil because the player has left already. Can someone point me in the right direction. Thx in Advance.
Since no content was provided, I'll provide you with a simple fix.
game.Players.PlayerRemoving:Connect(function(Player) -- Save Data here end)
This event is fired when the player leaves. Just save data when they leave, this should fix your problem.
Hopefully this helped!
Best of luck developer!
BlackOrange3343