How to make BindToClose only initiate 1 Save?

I’ve been having this issue with BindToClose recently, and my main issue is that it initiates around 2-3 saves with my system. I only need it to save once, like how normally everybody does it. I’ve done a few tests and it does seem like PlayerRemoving fires before BindToClose, and that also obviously has a save initation it it, which I don’t understand why, but it has halted me from releasing my game because with some of my systems using os.time() and such, it breaks those because it initiates multiple saves (but that is irrelevant, I still don’t know how to fix this issue.) I have tried wrapping events, using a connection and disconnecting it, and a closing variable (or so a debounce). But nothing has worked! I’m just completely confused.

1 Like

What do you mean with starting saves?

Initially, BindToClose would loop through every player in the server and save their data, and of course PlayerRemoving would do the same but for a specific player. However, since these are both firing and PlayerRemoving fires first, it causes two saves. I only want one save to happen, and that’s with BindToClose.

Nevermind, literally JUST figured it out. Sorry!

Perhaps you would care to share what you found was the cause and how you fixed it.