In the game I'm working on, people receive gear and hats. and I hear that the way to save this is with data stores. I have a few ideas on how I could save the items, but I was wondering what the most efficient way is. Thanks in advance!
Well, there are many ways to go about this to make it the most efficient but what you could do is save each player's userid as the key, and save a table of the names of all their gear to the key. You could keep the gear in the serverstorage and sift through all the strings in the table and use findfirstchild to get the gear.
local datastore = game:GetService'DataStoreService':GetDataStore("gears") local serverstorage = game:GetService'ServerStorage' game:GetService'Players'.PlayerAdded:connect(function(p) local key = p.UserId p.CharacterAdded:connect(function(c) local data = datastore:GetAsync(key) if data and data ~= nil then for i,v in pairs(data) do local found = serverstorage:FindFirstChild(v:lower(),true) if found then found:Clone().Parent = p:WaitForChild'Backpack' end end else datastore:SetAsync(key,{}) end end) end)
that's as far as i'll go to show you how to do it