Datastore | Saving a server object instead of a player object | Expanded information

Hello.
So I’ve got this system where you create a “Guild”, invite other members, give them ranks, set a tax rate, and more. I’ve got a question about saving this.
I want to save this folder of information on a set interval, instead of when the player leaves, if you understand what I mean.

Like this.

A player creates a guild:


It is created, and thru a server script this is created:


In the guild folder, the Guild the person created has its information stored there.

Now, a player can invite another player, and then they will officially be apart of that guild, and will have their own value in the “GuildMembership” folder.
Now what I want is when the “Owner” of the guild leaves the server, the information should not save, but continue to exist until, so that the other member of the guild can participate in the activities and be shown as a member of that guild.
Now what I can’t figure out what to do is when the last member of the guild leaves the server, and the server shutdowns, the guild information saves, so that when the next time the server starts up, the guild information will be loaded in, even though there is no guild member online.

So when the server starts up on new, the data will be loaded, even if the player is a low ranking member.

I assume I can’t use Datastore as this is for when the player who created it would join?

I’m kind of confused about how to proceed. I’ve read about Serialization, but couldn’t really grasp the content. I’m a beginner in using Datastores. I use Datastore2 for player values.

I can provide more explanation if needed! Any help is appreciated.

Thanks.

1 Like

I don’t know if you found how to do this. But you can use a datastore! Just make a key for the server and load it in. Save on intervals/or when a guild is created. And then do a quick save if possible on shutdown?