PlayerService.PlayerRemoving:Connect(function(Player)
DataStore:SetAsync(Player.UserId,game.ServerStorage[Player.UserId].Data) -- Saves players data folder
game.ServerStorage[Player.UserId]:Destroy()-- Destroys folder when player leaves
end)
And because Player Removing is always almost fired first the data store will throttle and I was wondering if this was normal
Cause most of the time Player Removing fires and that destroys the data folder also
which means bindtoclose cant save the data since it is destroyed
game:BindToClose(function()
for i,v in pairs(game.Players:GetPlayers()) do
DataStore:SetAsync(v.UserId,game.ServerStorage[v.UserId.Data])
end
wait(30)
end)
But since if Player Removing fires which it fires almost 99% of the time
It destroys the folder with the data in server storage
also almost everytime since Player Removing is fired before bindtoclose and since they both save in the 6 second cooldown they throttle
SO IN CONCLUSION I WAS WONDERING IF THIS WAS NORMAL

5 comments
Try my new suggestion
only use PlayerRemoving no need to bind to close if you dont have to (please like trying to get a new rank)
BindToClose is actually a better choice
Do what I suggested when you asked this two days ago. Have the BindToClose handler disable your PlayerRemoving code and do all the saving itself. PlayerRemoving will not fire before BindToClose except if a player just happens to leave right that moment on their own.
I mean, do you really need to destroy the player data? If the only issue is the removal of data before bind to close fires, then you could just do the simple task of not removing the information to begin with