How to make it so data saves when a player leaves and they were the only one in it

So I’m trying to make a building game where it saves every time a server closes or the last players leaves. It’s like a sandbox game where everything saves, kinda like minecraft.

Look at game:BindToClose():

Only at most 3 things run after bindtoclose, then the thing stops. Datastores take a while, longer than most other things like print(), and therefore won’t work

I made a tutorial regarding exactly this.