The data might not save properly in studio because the game leaves really fast, or the server shuts down in an unexpected way. But there is a really really useful function for that (as some people mentioned already.) game:BindOnClose()!
You can check more about this function or how to properly save here.
P.S. This thread helped a lot of people. Including me!