I have this data store script and it sometimes loadings my tools like its supposed to do and sometimes it doesn't why does this not work
local ds = game:GetService("DataStoreService"):GetDataStore("toolsave555")
game.Players.PlayerAdded:connect(function(plr)
wait(2)
local player = plr.UserId
local data = ds:GetAsync(player)
if data then
for i,v in pairs(data) do
if game.Workspace.axes:FindFirstChild(v) then
local axe = game.Workspace.axes:FindFirstChild(v):Clone()
axe.Parent = plr:WaitForChild("Backpack")
end
end
end
end)
game.Players.PlayerRemoving:connect(function(plr)
local player = plr.UserId
local saved = {}
for i,v in pairs(plr.Backpack:GetChildren()) do
table.insert(saved,v.Name)
end
ds:SetAsync(player,saved)
end)
