Best way to organize multiple values on datastore and game

I wasn’t sure on how to write the title but I’ll explain it better here. I’m a mediocre scripter and I’m making and asymmetric game (Like forsaken, dead by daylight or any other game like this), and Eventually i will make skins for each survivor character and also each killer character, and I just realized that I’ll have to somehow save the player’s equipped skin for each killer and survivor in a way that both the game and the data store could access it easily, I could make multiple values on a data store and this would probably work but it just doesn’t sound like a good way to do it. I need to find a way to do this in a more efficient way, if there is one of course. Thanks!

1 Like

Convert your player’s active selection into a table that you convert to a string using JSONEncode to be saved in a datastore. Use JSONDecode when loading this string and send the information into any data structure you prefer.

Instead of saving each skin or equipped value separately you should save everything in a single PlayerData table that contains survivors, killers, owned skins per character, and the equipped skin per character.

Maybe like this:

PlayerData={
    Skins={
        Survivors={
            Medic={
                Equipped="Default",
                Owned={
                    Default=true,
                    Red=true,
                    Gold=false
                }
            },
            Scout={
                Equipped="Blue",
                Owned={
                    Default=true,
                    Blue=true
                }
            }
        },
        Killers={
            Shadow={
                Equipped="DarkFire",
                Owned={
                    Default=true,
                    DarkFire=true
                }
            }
        }
    }
}