Gun skin datastore

I am trying to make a datastore where i can store all of the gun/weapon skins for my game but i am unsure on how i should save them.

Should i save it as a table inside a table (rarity etc) within the main DB or should i save it some other way

I made a tutorial on this, if you read it you might want to store decals or textures if it’s for a mesh.

1 Like

would it work if i wanted different qualities of skin like in CSGO? or would i have to leave that out

Well I’m not sure why you would want a low quality version of a skin in the first place? That would seem like a bad ux to me.

you know what i mean tho. ill try to modify the ds to make it better tho

1 Like

What I’d have is… it all stored in a table

{Gun = “Pistol”, Status = “Factory New”} ← when they join, just check the Type.

Personally yes, I would save a table of data within a table. For instance; let’s say my table that I want to save and store all of my data in is called “savedSkins”.

local savedSkins = {}

I would save all of my data inside of this table, however since each piece of data you wish to save has multiple properties, we should contain each property inside of it’s own table, so we don’t have random pieces of data all jumbled up together. We could do this by following what @AspetType said:

So now when the information is put into our savedSkins table, it would visually look something similar to this:

local savedSkins = {
    {weapon = "Pistol", Status = "Minimal Wear", skin = ""};
    {weapon  = "AK47", Status = "Battle-Scarred", skin = ""};
    {weapon = "M4A4", Status = "Well-Worn", skin = ""};
}

We could then save this whole table to the datastore when the player leaves and iterate through it when the player rejoins, check the table contents and give the player everything they own.

3 Likes