I have API Services enabled heres the code help pls, Also all the values are in a folder its meant to save the values in the folders.
local SS = game:GetService("ServerStorage")
local DSS = game:GetService("DataStoreService")
local DM = require(SS.MainModule)
local Ignore = {"Hunger", "Stamina"}
local function LD(P)
local SD = DM("Data", P)
if SD:Get() ~= nil then
for i,v in pairs(SD:Get()) do
if v[3] and v[2] and v[1] and P:FindFirstChild(v[3]) then
for i,b in pairs(P:FindFirstChild(v[3]):GetDescendants()) do
if b.Name == v[1] then
b.Value = v[2]
end
end
end
end
end
end
local function SD(P)
local PDT = {}
for i,v in pairs(P.Characterstats:GetDescendants()) do
if v:IsA("StringValue") or v:IsA("NumberValue") then
table.insert(PDT,{v.Name, v.Value, "Characterstats"})
end
end
for i,v in pairs(P.Test:GetDescendants()) do
if v:IsA("StringValue") or v:IsA("NumberValue") then
table.insert(PDT,{v.Name, v.Value, "Test"})
end
end
for i,v in pairs(P.CInfo:GetDescendants()) do
if v:IsA("BoolValue") or v:IsA("StringValue") or v:IsA("IntValue") then
table.insert(PDT,{v.Name, v.Value, "CInfo"})
end
end
for i,v in pairs(P.Clothings:GetDescendants()) do
if v:IsA("BoolValue") or v:IsA("StringValue") or v:IsA("IntValue") then
table.insert(PDT,{v.Name, v.Value, "Clothings"})
end
end
for i,v in pairs(P.Chains:GetDescendants()) do
if v:IsA("BoolValue") or v:IsA("StringValue") or v:IsA("IntValue") then
table.insert(PDT,{v.Name, v.Value, "Chains"})
end
end
for i,v in pairs(P.Accesories:GetDescendants()) do
if v:IsA("BoolValue") or v:IsA("StringValue") or v:IsA("IntValue") then
table.insert(PDT,{v.Name, v.Value, "Accesories"})
end
end
for i,v in pairs(P.Valuestats:GetDescendants()) do
if v:IsA("BoolValue") and not table.find(Ignore, v.Name) or v:IsA("StringValue") and not table.find(Ignore, v.Name) or v:IsA("IntValue") and not table.find(Ignore, v.Name) then
table.insert(PDT,{v.Name, v.Value, "Valuestats"})
end
end
for i,v in pairs(P.SafeStats:GetDescendants()) do
if v:IsA("StringValue") or v:IsA("BoolValue") or v:IsA("IntValue") then
table.insert(PDT,{v.Name, v.Value, "SafeStats"})
end
end
local PD = DM("Data", P)
PD:Update(function()
return PDT
end)
end
function PA(P)
for i,v in pairs(script.Data:GetChildren()) do
if v:IsA("Folder") then
local A = v:Clone()
A.Parent = P
end
end
LD(P)
while wait(30*60) do
if tonumber(DSS:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.SetIncrementAsync)) > 50 then
SD(P)
else
if tonumber(DSS:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.SetIncrementAsync)) > 50 then
SD(P)
end
end
end
end
function PL(P)
if tonumber(DSS:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.SetIncrementAsync)) > 50 then
SD(P)
end
end
game.Players.PlayerAdded:Connect(PA)
game.Players.PlayerRemoving:Connect(PL)

1 comment
WOAH that's an advance datastore script, idk what to answer here, i only know the basic datastore sorry ????????