Need help on my datastore 2.
Here is the full script
local datatable = game.ServerStorage.DataStore
local datastore2 = require(1936396537)
local function savefunction(plr)
local tab = {}
for i,v in pairs(datatable:GetChildren()) do
if plr:findFirstChild(v.Name) then
local faketable = {}
for e,a in pairs(plr[v.Name]:GetChildren()) do
faketable[a.Name]= a.Value
end
tab[v.Name] = faketable
end
end
return tab
end
datastore2.Combine("MainKey","0.00.03","Tools_0.00.03","Teleport_0.00.03")
game.Players.PlayerAdded:Connect(function(plr)
local data = datastore2("0.00.03",plr)
local data2 = datastore2("Tools_0.00.03",plr)
local data3 = datastore2("Teleport_0.00.03",plr)
for i,v in pairs(datatable:GetChildren()) do
local clone = v:Clone()
clone.Parent = plr
end
if data:Get() ~= nil then
for i,v in pairs(data:Get()) do
if plr:FindFirstChild(i) then
if v then
for e,a in pairs(v) do
if plr[i]:FindFirstChild(e) then
plr[i][e].Value = a
end
end
end
end
end
end
if data2:Get() ~= nil then
for i,v in pairs(data2:Get()) do
local x = game.ReplicatedStorage.BuyableItems:FindFirstChild(v)
if x then
local a = x:Clone()
a.Parent = plr.StarterGear
local a = x:Clone()
a.Parent = plr.Backpack
end
end
end
if data3:Get() ~= nil then
for i,v in pairs(data3:Get()) do
local tele = game.Workspace.portals.buyable:FindFirstChild(i)
if tele then
end
end
end
plr.StarterGear.Changed:connect(function()
local tab = {}
for i,v in pairs(plr.StarterGear:GetChildren()) do
table.insert(tab,#tab+1,v.Name)
end
data2:Set(tab)
end)
plr.StarterGear.ChildAdded:connect(function()
local tab = {}
for i,v in pairs(plr.StarterGear:GetChildren()) do
table.insert(tab,#tab+1,v.Name)
end
data2:Set(tab)
end)
plr.StarterGear.ChildRemoved:connect(function()
local tab = {}
for i,v in pairs(plr.StarterGear:GetChildren()) do
table.insert(tab,#tab+1,v.Name)
end
data2:Set(tab)
end)
for i,v in pairs(datatable:GetChildren()) do
if plr:findFirstChild(v.Name) then
for e,a in pairs(plr[v.Name]:GetChildren()) do
a.Changed:Connect(function()
data:Set(savefunction(plr))
end)
end
end
end
end)
Here is the part I need help w/
if data3:Get() ~= nil then
for i,v in pairs(data3:Get()) do
local tele = game.Workspace.portals.buyable:FindFirstChild(i)
if tele then
end
end
end
need it to basically save Checked
boolvalue