How can I keep my data from saving if pcall fails?

This is happening because the error happens after the saving. the :SetAsync() call succeeds THEN the pcall errors.

To simulate a failing call, you could move the error to before the SetAsync. (By the way, try using the builtin error() function instead.

But besides all of this, SetAsync has been prone to data loss because it has no handling, so if you pass in nil, it just completely clears the player’s data. I’d recommend using some of the many, many datastore modules that take care of the messy saving process automatically (I use ProfileService, because it’s super good at preventing data loss and easy to use once you understand it).