local ds = game:GetService("DataStoreService"):GetDataStore("Tool10") --Tools
local ds3 = game:GetService("DataStoreService"):GetDataStore("Shield10") -- accessories
game.Players.PlayerAdded:connect(function(plr)
local key = "id-"..plr.userId
pcall(function()
local tools = ds:GetAsync(key)
if tools then
for i,v in pairs(tools) do
local tool = game.ServerStorage.Tools:FindFirstChild(v)
if tool then
print("loading tools")
tool:Clone().Parent = plr:WaitForChild("Backpack")
tool:Clone().Parent = plr:WaitForChild("StarterGear")
end
end
end
local Shields = ds3:GetAsync(key)
if Shields then
for i,v in pairs(Shields) do
local sh = game.ServerStorage.Accesss:FindFirstChild(v)
if sh then
print("loading shields")
local backpack = plr:WaitForChild("Backpack")
sh:Clone().Parent = backpack:WaitForChild("shields")
end
end
end
end)
end)
game.Players.PlayerRemoving:connect(function(plr)
local key = "id-"..plr.userId
pcall(function()
local toolsToSave = {}
local shieldsToSave = {}
for i,v in pairs(plr.Backpack:GetChildren()) do
if v then
table.insert(toolsToSave,v.Name)
end
end
ds:SetAsync(key,toolsToSave)
for i,v in pairs(plr.Backpack.shields:GetChildren()) do
if v then
print(v.Name)
print("saving shields")
table.insert(shieldsToSave,v.Name)
end
end
ds3:SetAsync(key,shieldsToSave)
end)
wait(5)
end)
COMMUNITY QUESTION
Can anyone see why this script is saving tools, but not accessories?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Sorry, my indentions seems messed up in the post, but hopefully that is readable. LOL