You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I need to make a saving system for a bunch of clothing (30+), I have a system that makes bool values with the clothing names (Owned or Not Owned) I just need to figure out how to save the values that corresponds to the clothing name. I don’t want to do a datastore per item, I’d like a table and then save said table and when the player joins a function takes the already created values, matches them, and assigns the correct value from the table
What is the issue? Include screenshots / videos if possible!
I have the slightest idea how to load and save values in a table or anything like that
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I look but none of them make sense or are related to my issue
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
this image is the code used to create the value and the stuff at the bottom is my guess on how it would filter, How do i save the Bool Value name and the value itself?
Well, as @Find4U2Go recommended, saving them in tables is the best. For instance
game.Players.PlayerAdded:Connect(function(plr)
--this is just a small bit for the loading of data
local data = ds:GetAsync(plr.UserId)
for i,v in pairs(data) do
local item = OwnedClothing:FindFirstChild(i)
if item then
item.Value = v
end
end
end)
function save(plr)
local data = {}
for i,v in pairs(plr.OwnedClothing:GetChildren()) do
data[v.Name] = v.Value
end
ds:SetAsync(plr.UserId, data)
end
game.Players.PlayerRemoving:Connect(save)
game:BindToClose(function()
for i,plr in pairs(game.Players:GetPlayers()) do
save(plr)
end
end)
Now, I only provided the saving parts, but I think you can figure the rest out.
I know this is old but I have the same problem, when I tried this is got the following error: invalid argument #1 to 'pairs' (table expected, got Instance)