How to save this data with the PlayerRemoving event

Hi, so I am creating a game in which three things must be save. These include nametags, effects, and powerups.
With the nametags and effects, I must index a table, since it is in the format of:

Items = {}
Items[plr.Name][“NameTag”] = {[“NameTagName”] = true/false} (plr being the player, true/false being the value, whether the player has the item equipped.)

Here is what I got: https://gyazo.com/2543bbacc2840e9602ca51411dfeee79

Currently, my solution to solving this issue was to set the data store every time the player bought an item, and every time a player equipped an item. The data store request was of course throttled. All help is greatly appreciated. Thank you very much! :slightly_smiling_face:

1 Like

The general practice to save everyones data every 60 seconds and when they leave.

However I highly recommend using DataStore2 by @Kampfkarren. It is a tried and proven method of storing data with almost no chance of data loss.

4 Likes

I use this for a somewhat popular game and there have been 0 reports of data loss. Amazing module.

2 Likes

Alrighty, I will give it a try. Thank you both very much for the help! Greatly appreciate! :slight_smile:

Roblox doesn’t like it when you use this method. You’re exploiting the fact that datastores have an infinite amount of keys.

Thats just a joke that @berezaa makes.
Here’s a recent thread discussing the issue.

1 Like

It’s not stressful on the servers 1 bit?
I might use it then. I might add if the datastore save is older than a week it deletes it but I’m unsure.

It would be more stressful on the servers to delete old saves then it would be to just do nothing. Servers are “stressed” when they need to do something to data. If the data is just there and it isn’t touched, it won’t negatively impact your game at all.

5 Likes

I’m gonna use your method of storing data until a “better” method shows up. I made a module script that will use your method.