I've been thinking about this a lot lately and I have some methods but I'll like to see what other peoples methods are, I just want to know what other people do.
My methods so far:
-debouncing:
the thing is I'm not sure if the function is going to run after the player leaves the game in other terms if I do a debounce then wait 6 seconds before another request and the player leaves and it doesn't continue the function it won't save their data.
-Saving when the player leaves:
so this will put the data in replicated storage and it will save when it leaves but the issue is if the player loses connection another issue with this is that I'm not sure how to make a function that detects when a player lost connection and then it goes and runs a function while the player isn't there that saves the data.
-queues
so this is what I made currently and it basically has a number value if the value is 0 then when it runs the saving function it will increase the value by 1, save, wait six seconds and minimize the function by 1 if the function is over 3 then it will wait until the function is less than 3 and then run the saving function. There's a big issue with this which is: if the player leaves will the waiting function still run???
PLEASE SHARE YOUR METHODS
I REALLY NEED HELP!

3 comments
http://wiki.roblox.com/index.php?title=API:Class/Players/PlayerRemoving
Using player removing isn't a good idea, at least by itself. If you lose internet connection, you lose ALL of your data. That's why it's good to try saving data every 6 seconds (or maybe more, the time may change in the future, who knows)
fighter169 is clueless, PlayerRemoving will be called if a player loses connection. Everyone uses PlayerRemoving.