Im having trouble making this Datastoring script Filtering Enabled. Any idea on what to add to make it do so?
local DSService = game:GetService('DataStoreService'):GetDataStore('DBSRData')
game.Players.PlayerAdded:connect(function(p)
wait(2.5)
-- Define variables
local stats = game.ServerStorage.Data:Clone()
stats.Parent = p
local uniquekey = 'id-'..p.userId
local names = {}
for i, v in pairs(p.Data:GetChildren()) do
table.insert(names, v.Name)
end
-- GetAsync
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
for i, v in pairs(p.Data:GetChildren()) do
v.Value = GetSaved[i]
end
for i=1, #GetSaved do
--print(i .. ": " .. names[i] .. " = " .. tostring(GetSaved[i]))
end
else
local NumbersForSaving = {}
for i, v in pairs(p.Data:GetChildren()) do
table.insert(NumbersForSaving, v.Value)
end
DSService:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(p)
local uniquekey = 'id-'..p.userId
local Savetable = {}
for i, v in pairs(p.Data:GetChildren()) do
table.insert(Savetable, v.Value)
end
DSService:SetAsync(uniquekey, Savetable)
end)

1 comment
https://www.youtube.com/watch?v=4Dc_bri9mjs