I plan on saving customizable user items in a data store, but my problem is how would I structure it?
Lets say there there are 20 types of bikes the user can customize in 7 different category's (Wheels, color, handle bars ETC. ), would I make 20 different data stores with 5 tables in them? Or would I make 1 datastore and somehow cram all the info into a table?
EDIT:
Bike format:
|--wheels (7 options to pick from) |--paint (7 options to pick from)
bike 1 --| bars (7 options to pick from)
There are 20 different types of bikes total. How would I save all that information. Multiple data stores?
Since datastores can save tables, this is very easy.
local ds = game:GetService("DataStoreService"):GetDataStore("DataStoreName") local defaultItems = { -- this will be what the player gets if they're new to the game "AwesomeHat", -- idk some random item name "CoolBeans", -- another random one -- add more of the items you want } local data = {} -- where all the players data is stored for everyone in the server game.Players.PlayerAdded:connect(function(plr) local tab = ds:GetAsync(plr.userId) if not tab then tab = defaultItems end -- if they're a new player set to the default table local found = false for i = 1,#data do -- makes it so multiple data's aren't stored in the data tab if data[i][1] == plr.Name then found = true break end end if found == false then table.insert(data,{plr.Name,tab}) end end) game.Players.PlayerRemoving:connect(function(plr) local tab = nil for i = 1,#data do if data[i][1] == plr.Name then tab = data[i][2] brek end end ds:SetAsync(plr.userId,tab) -- saves their data end)
Hopefully that helps a bit..