Call event on game closing (game.Players.PlayerRemoving) and in that moment client send message with client settings to save in datastore. But the server closes before this message arrives.
You have to give more info, it’s such a bland post and nobody can help you solve your issue without knowing what they’re dealing with.
You can save client-side data to the DataStore in a way that is secure and server-agnostic.
Note: This is not a solution for saving client-side data that is not secure. You can only save secure data to a DataStore.
This is possible, but it’s very bad practice.
You can create a game setting (as a client-side RemoteEvent
), and set that from the client.
However, this is not the best solution.
While it works, it’s not as secure as a DataStore.
The server doesn’t need to be open for the client to save data.
If you’re using a DataStore, you can save data from the client-side, and it will be saved securely.
You can use the StorageService
to save data to the DataStore, and the StorageService
is available client-side.
However, the data you save to the DataStore must be secure.
If you use the DataStoreService
, then you can use StorageService
to save data to the DataStore.
This is possible, but you have to have the server open to save the data.
To save data to the DataStore, you can use StorageService
.
Here is an example:
local DataStoreService = game:GetService("DataStoreService")
-- Replace "MyDataStore" with the name of your DataStore
StorageService:GetDataStore("MyDataStore"):SetAsync("MyKey", "MyValue")