What should I use; MemoryStoreService or Folder Instances w/ Values?

My game is setup in a way where dying could be prevalent, so I want to make a system that allows one of the Characters tools to be able to fetch the same information again quickly so it’s the same across player death.

Since DataStoreService throttles and has too many limits, I feel like the constant access of data and updating of data would not be practical for it.

To put it more specifically, I want to make it so a Phone Tool has a battery level, and you’ll need to charge it after using it for awhile. However, when the player dies the battery could jump back to 100% because the original tool offers 100%.

I need some quick way to be able to set it back to the percentage the phone had before so the player cannot exploit the charging mechanic of the game.

I’ve read over MemoryStoreService and the use of Folder Instances, but I really don’t know which one is more better for my use case.

Any help would be greatly appreciated. Thank you.

I know this sounds a lot like a scripting support topic, but I’m asking which one would be more efficient; I don’t have any code to debug, I just need help figuring out which one would be more practical for a game mechanic, which is the key word here for this category of the forum.

I do believe MemoryStoreService would be overkill and not necessarily faster (in fact, it wouldn’t be since you’re adding more complexity to something as simple as reading a value that’s stored somewhere)
Using an object like a IntValue, or better, using an attribute attached to the player, would be: faster, doesn’t have any limitations, and has minimalistic possibility of failure.

4 Likes

In regards to saving across servers, that’s also something I wish to implement. I want to be able to reload the percentage of Charge onto the Phone tool after a players death, but I also want to make sure they cannot just rejoin and then the phone will be back to 100% again.

That’s sort of the main reason why I brought up MemoryStoreService because (from what I read) seems to be for use of rapid access of data that changes quickly (such as number decreasing at a steady pace) while also storing it for a set amount of time (not user defined)

1 Like

Why not use DataStoreService? The issue with MemoryStoreService is that the memory will go away after a while which at some point may be out of your control (if the player doesn’t play for weeks, for example). Data stores are a pretty direct solution especially if the data is tied to the player directly (Player A’s phone is at 50%, player B’s is at 25%, and so on). Then in-game, once the data is loaded, track it with some value object or attribute. When they leave, save the data again and that should cover everything you need.
Again, MemoryStores have some limitations that make it pretty scary to work with when you’re dealing with a lot of players. You’d have to be careful not to hit limits. Datastores are from my understanding much more scalable.

3 Likes

I appreciate the explanation on the manner.

I didn’t consider the fact that I could save the players data upon leaving and reloading it back onto the Attributes when the player loads in, that way it will effectively remove the exploitation of this game mechanic.

The only thing I’m concerned about in terms of saving player data when they leave, is the chance of failure. I’ve heard a lot about how when the player leaves, and the script saves data that sometimes the changes are never registered in time causing loss of data.

In my case it wouldn’t be terrible if a couple people get away with 100% again, but it would be nice to know how to effectively prevent that from happening. If there is no long term solution, I suppose this is all I need from this topic.

Thanks once again.