Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

How do I save objects? DataStores only save player data!

Asked by
piRadians 297 Moderation Voter
5 years ago
Edited 5 years ago

Datastores can only store player data, how would I store,for example, the amount of money a store through ALL the servers has made, by selling items? (aka global counters)

2 answers

Log in to vote
1
Answered by
Rinextel 291 Moderation Voter
5 years ago
Edited 5 years ago

You can't store Instances. Roblox doesn't serialize them, because JSON has no support for them, and Roblox doesn't support binary data structures for storage (Truth - Roblox actually doesn't like a lot of binary values).

The solution?

Store the information which describes the Instance. Is it an IntValue? Store the number. Part? Store the information to make it, such as the name of the thing you cloned it from. Weapon? Store the name. Serialization is an important part of storage which was missed out from DataStores for some unknown reason.

0
Speaking about JSON, could I use HTTPService to achieve my goals? piRadians 297 — 5y
0
0
You cannot save any objects, you can either save a table, string or a number. angeI1001 123 — 5y
Ad
Log in to vote
0
Answered by
0RKH 35
5 years ago

DataStores can only save tables strings or numbers, no objects or classes can be stored.

Answer this question