How to save a custom character to datastore

I am adding character customization to my game and I want the character the player makes to save after they leave the game. How can I save a character like this to datastore, I am pretty sure you can only save strings and numbers to datastore so I probably can’t just save the whole character. Just wondering what you guys think.

I’m pretty sure the only way to do this is using serialisation. You can make a table of data containing enough information to recreate the character when the player rejoins.

Oh like assign each shirt I add into the game a number?

No, I meant more like:

local data = {["char"] = {
  ["shirt"] = shirt id,
  ["hat"] = hat id,
  }

You can add a lot of information in each category concerning positional data if you wanted as well.

3 Likes