function getitems(plr)
local holder = game.ReplicatedStorage:FindFirstChild(plr.Name.."'s Items Holder"):GetChildren()
for i,v in pairs(holder) do
if v.ClassName == "StringValue" then
if v.Name ~= "Value" and v.Value ~= "" then
local id = game.Players:FindFirstChild(plr.Name).userId
itemDataStore:SetAsync(id..":items", v.Value)
end
end
end
end
local getitems = itemDataStore:GetAsync(newplayer.userId..":items")
if getitems == nil then
print(newplayer.." Has No Items!")
else
local newitem = Instance.new("StringValue")
newitem.Name = getitems
newitemValue = getitems
newitem.Parent = game.ReplicatedStorage:FindFirstChild(newplayer.Name.."'s Items Holder")
end
im trying to save multiple values in a folder in replicated storage but this current script only saves 1 of those values not all of them. im pretty new to datastore and scripting in general. any help appreciated TY.

1 comment
You could store the values in a dictionary, with the index being the value's name and value being the actual value. An example being {["Cash"] = 100, ["Level"] = 5}. Once you have the dictionary created, save it to the Datastore. NOTE: You may have to use JSON Encoding/Decoding for the dictionary.