Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Character Creation Saving and Loading Help?

Asked by
Nidoxs 190
6 years ago
Edited 6 years ago

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?

Answer this question