How should I save a complex Unit System?

Fairly small question here, but I’ve been wondering as to how I should go about saving various units, each with their own stats, appearances, and so on. I have a 2 ideas, but I am not sure as to which I should choose.

1: Each unit has their personal datastore tied to the player, saved in multiple string values
2: Save everything in one single string value as a large dictionary.

If you have any other ideas, please do share. Thanks.

Could you explain what you mean by a unit? What kind of game would this be applied to?

It might help you to know about HttpService:JSONEncode() This can convert a table into a string.

When I say “Unit” I mean by like a NPC that a player can ‘command’ and control.

I think it would be easier to access if you stored the unit data by unit - so that they have their own subsection of the player’s datastore.

["Units"] = {
            ["Unit1"] = {["Height"] = 10, ["Strength"] = 50}}

This would also mean that you could easily add units to the player’s datastore via a more direct, comprehensive route.

1 Like