Script doesn't stops at pcall

Here’s the code I have for saving some stats

And it’s supposed to save (obviously) but also it should print “saved” afterwards with the datastore.

This is the output
image

As you can see it is not printing “saved” in fact it just stops even after a pcall? From what I know, the script should ignore unsuccessful pcalls and continue running?

1 Like

Can you print setSuccess before the if statement and see what its returning? Can you also please provide what your “StatStore” Variable is defined and where?

Have you tried adding game:BindToClose() to allow time for data saving? Sometimes the server shuts down too fast.

game:BindToClose(function()
task.wait(1) -- keeps the server open for 1 second
end)