Can you DataStore a table of Instances?

Hello! So I have made an inventory system for a game I’m working on with a friend and I was wondering if it was possible to DataStore a table of Instances.

The reason I ask is because the way I handle the items within the player’s inventory is object oriented, meaning I have a folder within ServerStorage that holds the items they pick up.

I have a module that I will be using to do the Data Storing but was wondering if it was even possible to DataStore a table of said instances.

I’ve tried looking this up but couldn’t find consistent answers.

Thanks for the help!

–Bitterman1021

You can’t, but you can serialize any instances. But I recommend against direct serialization unless it’s some sort of freeform building game. Just save the name of whatever they have along with maybe some configuration data.

2 Likes

Oh that’s unfortunate…:pensive:

So if I understand this correctly could I just have a folder in ServerStorage that can be used as a database for objects, save the names of the objects in the player’s inventory into a table, and then clone the items in the database into the player’s inventory based on the saved names?

Yeah that’s relatively the proper move. The data that’s stored should only be enough to recreate it later on, whether that’s from a named reference to an existing object in storage or just enough metadata to recreate it from scratch.

2 Likes

Ah I see! Thank you both very much for the help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.