Datastore is not saving a string value when the player leaves the game

Hello. This happens because the server shuts down when the last player leaves. PlayerRemoving event is not fired.
You should use game:BindToClose to solve this. I’ll link a post explaining that in detail.

https://devforum.roblox.com/t/how-to-properly-save-player-data-in-data-stores-upon-server-close/313218