I am making a Character Creation System and I want to save each choice in a Table, in a DataStore.

For example:

local DataStoreService = game:GetService("DataStoreService")
local CCDataStore = DataStoreService:GetDataStore("CCDataStore")

local CCTable = { 
	["Shirt"] = 0, 
	["Pants"] = 0,
	["SkinColor3"] = 0,
	["HatIndex"] = 0,
}

CCTable["Shirt"] = CCDataStore["Shirt"] or 0
CCTable["Pants"] = CCDataStore[CCTable["Pants"]] or 0
CCTable["SkinColor3"] = CCDataStore[CCTable["SkinColor3"]] or Color3.new(255, 204, 153)--Otherwise make it White Skin Colored
CCTable["HatIndex"] = CCDataStore[CCTable["HatIndex"]] or 0

--Shirt,Pants would be IDs, SkinColor would be Color3 Value and HatIndex just a number that is assigned to a certain hat.

But, I don't understand how to save it, or if that above is right, please can I get some help as to how to save tables, with different data types, into DataStores?

1 comment