I'm making a space game where I need to persist items using a DataStore. I can store the item's data in a table, however I need to reference it in multiple locations:
- The player's stats database
- The database for the solar system it is in
I need to access a list of every item belonging to a player, as well as a list of every item in a specific solar system. How should I format my data to be able to get this functionality? I can't just duplicate the item into the two DataStores because I need to move it around and update its information.
If I was storing the information in a MySQL database then I would just use foreign keys, but there's no ROBLOX equivalent.
I originally thought to store each object using its own specific ID as the DataStore key, but then there's no easy way (that I can think of) to assign a completely unique ID number to the object when it is created. This would also mean that loading a solar system with a lot of objects would take ages due to the request limits.

3 comments
If I understood correctly you want to be able to access the datastore from any script?
With the script : print("hax on!")
@RequiredModule, I want to be able to link together the data, so I can have a database of structures which can be referenced from the player's inventory as well as solar systems.