Data continues to get wiped

So my data keeps getting wiped for a game I’m making, and I have a save data script made. Is it just me or do I need to do something else?

1 Like

Data wiping is typically an issue with the developer’s code. Sometimes, DataStores experience internal issues with endpoints or otherwise, though that’s a rare case.

Would you mind posting your data management script so that anyone viewing this thread can attempt to help you?

Sure, here is a screenshot.

If you’re testing the game in Studio and it isn’t saving/fetching data, this could be because you haven’t allowed Studio to access API services such as Datastores. Try setting “Enable Studio Access to API Services” to true, if you haven’t already.

image

This can be found on the “Configure game” page :slight_smile:

Oh. Yeah, you aren’t supposed to use that. SaveInstance is part of Data Persistence, which is deprecated. The proper way to save data is through the DataStoreService. Feel free to search it up on the Developer Hub for articles on how to use it.

2 Likes

Ah, okay. Thank you for letting me know.

SaveInstance is deprecated, you should use DataStoreService instead!

2 Likes

So here is a script (not mine though) that saves data correctly.

I’d advise against using that code. It’s heavily flawed and the way it’s designed will cause throttling and data failures. DataStores have their own limitations to follow.

I can’t really tell you how to fix this since it’s fairly dependent on the structure of your game, but just know that it’s better to save a single table to a DataStore instead of saving many values in a loop.

It’s not just deprecated, it was completely removed.

No, you can still use it in scripts. It was not completely removed.
Edit 1:
image
image
image

Edit 2:
Wiki page saying it’s deprecated:
https://developer.roblox.com/api-reference/function/Player/SaveData
https://developer.roblox.com/api-reference/function/Player/SaveInstance

1 Like

The function still exists; the functionality was removed. SaveInstance, SaveNumber, etc. don’t work anymore. It works in studio in the command bar, but not in live games or in studio play solo. They still “work” in scripts (they don’t cause errors) because it would break games that used them more than they’d break with the lack of Data Persistance.

1 Like