Hi, I have an issue with my saving script. The tools don’t save and the script is not printing “data saved” yet there’s no error.
1 Like
You put if not tool:IsA("Tool") then return end
The return
cancels the recursive. Use continue
instead if you want to keep looping.
In my experience, player.Backpack
sometimes wont exist, I recommend using player:WaitForChild(“Backpack”) instead.
thanks for the help, do I apply this on every loop?
that doesn’t seem to be working, I have changed all of the loops
If its still not printing “data saved” on player removing, you need to add a BindToClose. In the BindToClose, loop through the Players and kick all of them, after that, task.wait(3)
after the loop to ensure their progress saves.
game:BindToClose(function()
print("Closing...")
for _, plr in pairs(players:GetPlayers()) do
plr:Kick() ——fires player removing
end
task.wait(3)
end)
1 Like
I forgot to mention that the metals (the first loop on player removal) saves when the tool loop is removed.