Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Saving a table of names via DataStore?

How do you go about saving the names of items in your Backpack to a table?

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.