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

How do I connect a name/id to a table, so I can access them both?

Basically if I save something into a table, I'd need to know the name of it + the asset id so I can put it in the players inventory labeling it the name.

How can I do this?

Example;

ds= game:GetService("DataStoreService"):GetDataStore("Example")

local rolled= game.ReplicatedStorage.RolledSomething

rolled.OnServerEvent:Connect(function(plr, name, id)
	local skins= {}
	ds:SetASync() -- How to add both to the table?
end)

This is for a skin script, so players can change their assets skin texture

1 answer

Use table.insert, or just do this:

	local skins = {name, id}
	ds:SetAsync(key, skins)

Though of note is that you shouldn't really be using SetAsync as it might overwrite some saved data. It's recommended to use UpdateAsync instead.

This discussion is preserved as it was. New answers, comments, and votes are closed.