I made a datastore that's supposed to save values in a folder but it isn't working?
The folder is called "Values"
Output:
Saved value 2
DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 0
Code:
game.Players.PlayerRemoving:Connect(function(player)
local DS = game:GetService("DataStoreService"):GetDataStore("ValueSave")
local Stats_Storage = player:FindFirstChild("Values"):GetChildren()
for val = 1,#Stats_Storage do
local sucess, err = pcall(function()
--Run Pcall
end)
if sucess then
print("Saved value "..val)
DS:SetAsync(Stats_Storage[val].Value, Stats_Storage[val].Name)
elseif not sucess then
warn("Oh no, error saving values: "..err)
end
end
end)
game.Players.PlayerAdded:Connect(function(player)
local DS = game:GetService("DataStoreService"):GetDataStore("ValueSave")
player:WaitForChild("Values")
wait(1.3)
local Stats = player:FindFirstChild("Values"):GetChildren()
for val = 1, #Stats do
local sucess, err = pcall(function()
DS:GetAsync(Stats[val].Value)
end)
if sucess then
print("Values loaded!")
elseif
not sucess then
warn("Oh, no! Error loading values: "..err)
end
end
end)
It also says it loads even though it dosen't
