How do you go about saving the names of items in your Backpack to a table?
COMMUNITY QUESTION
Saving a table of names via DataStore?
2 answers
Well, you had no go at it at all yourself so I won't explain it at all. It will require changing to fit your needs...
ds = game:GetService("DataStoreService"):GetDataStore("Tools")
ds:SetAsync(game.Players.Player1.userId,game.Players.Player1.Backpack:GetChildren())
To retrieve the data store:
ds = game:GetService("DataStoreService"):GetDataStore("Tools")
tools = ds:GetAsync(game.Players.Player1.userId)
Iterate
local names = {};
for k,v in next, Player.Backpack:GetChildren() do
names[k] = v.Name;
end;
DS:SetAsync(Key, names)
Assumes DS and Player are predefined as the DataStore and Player respectively.
Also assumes that Key is predefined.
This discussion is preserved as it was. New answers, comments, and votes are closed.
