Server building saving system

I’m trying to make a system that lets players build their own villages around the map (Village owners are gonna hire peasants, so i want villages to appear after the server stars and not when the owner joins). There will be 1 server with 100 slots and it’s gonna save the villages after it shutdowns or resets. Apparently, I need to use :SavePlaceAsync() but I’m still not entirely sure how that works. I’d be grateful if someone explained and possibly showed a line of code.

I’ve never used :SavePlaceAsync() before, but I have figured out a way to save builds. If you would like to use SavePlaceAsync instead, it is a function of AssetService.

Normally what I would do is have a folder within ReplicatedStorage which holds all builds in it. When the player leaves the game, add all of their builds names, positions and orientations to a table, and save that using a datastore.

For each build placed down, you should have saved the name, position and orientation of that build. When the player loads back into the game, find your folder which holds all build templates and do: Folder:FindFirstChild(savedBuild.Name), then clone it back into the workspace, apply the position an orientation that you saved when the player left the game.

Another thing. Note that if this is a multiplayer game, having a separate key for each player in the game could increase the number of builds someone can place down without running out of data in the DataStore

Building villages is going to be pretty limited. Around 10 spots around the map where you can buy a village and build it. So datastore isn’t running out of data. Also as i mentioned above, I need villages to spawn with the server and not the player. Peasants need to work after all, they can’t wait for their village master to join the game.

So you want the village to automatically spawn in whenever a server starts, even when the owner isn’t in the game?

Yes exactly. That’s exactly what i’m going for. Is it possible?

Yes, couldn’t you just load in the player’s key when the server starts instead of when the player joins the game?

Oh… Well, that would really make sense. Didn’t think of it. Thank you.

No problem! Any further questions, ask here. I’ve made this same thing before and I remember it being very confusing, especially when I couldn’t find anything about saving instances on the devforum.