local function save(plr)
local ALLsave = {}
local char = plr.Character or plr.CharacterAdded:Wait()
print("issaving")
for i, slot in pairs(plr:GetChildren()) do
print("hello")
if slot:IsA("Folder") then
table.insert(ALLsave, {slot.Equipped.Value, slot.Name, "slot", "slotsave", "random", "ez", "common", "alr"})
for n, folder in pairs(slot:GetChildren()) do
if folder:IsA("NumberValue") or folder:IsA("StringValue") or folder:IsA("IntValue") then
--Stats, class
table.insert(ALLsave, {folder.Value, slot.Name, folder.Name})
elseif folder:FindFirstChild("exp") then
for i, item in pairs(folder:GetChildren()) do
--Level
table.insert(ALLsave, {item.Name, item.Value, slot.Name, "level", "exp", "max", "levels"})
end
end
for b, item in pairs(folder:GetChildren()) do
if item:FindFirstChild("Equipped") and item:FindFirstChild("HotbarKey") then
--Combat Skills
--Weapons
table.insert(ALLsave, {item.Name, item.Equipped.Value, slot.Name, item.HotbarKey.Value, item.Parent.Name, item.Upgrade.Value})
elseif item:FindFirstChild("Equipped") and not item:FindFirstChild("HotbarKey") then
--Armour
table.insert(ALLsave, {item.Name, item.Equipped.Value, slot.Name, item.Parent.Name, item.Upgrade.Value})
else
--Inventory
table.insert(ALLsave, {item.Name, slot.Name})
end
end
end
end
end
local s, e = pcall(function()
CharDS:SetAsync(plr.UserId.."Slots", ALLsave)
end)
if s then print("Success saving slot for "..plr.Name) else warn(e) print("error saving slots") end
end
game.Players.PlayerRemoving:Connect(function(plr)
print("Left.")
save(plr)
end)
This is the part that doesn’t print anything
local s, e = pcall(function()
CharDS:SetAsync(plr.UserId.."Slots", ALLsave)
end)
if s then print("Success saving slot for "..plr.Name) else warn(e) print("error saving slots") end