Skip to content

Store

Description

The Store is the core object that connects Roblox DataStores with TraditionalSave, serving as the foundation that all other TraditionalSave classes attach to. Stores manage core features such as the save interval, and Profile creation.

Properties

StoreName: string

The name of the datastore that the Store will use. This is not recomended to be changed after creation because the DataStore being used will not update.

Config: StoreConfig

The configuration table that is used for everything that uses this store. This can be modified after creation but it is likely that certain properties and methods will not update.

Methods

ProfileFromPlayers

Store:ProfileFromPlayers(function(Profile)

end)

Description:

Returns a PlayerProfiles object for the given Store, calling the provided Callback for each created Profile.

Parameters:

  • Store - The Store in which the PlayerProfiles will be attached.
  • Callback - The function called for each created Profile. Recives the Profile as its argument.

Returns:


NewProfile

Store:NewProfile(Key)

Description:

Returns either a Profile thats attached to the given Key, or an Error object.

Parameters:

  • Store - The Store in which the Profile will be attached.
  • Key - the Key attached to the profile.

Returns:


NewPlayerProfile

Store:NewPlayerProfile(Player)

Description:

Creates a new Profile attached to a player using the players userID as a key.

Parameters:

  • Store - The Store in which the Profile will be attached.
  • Player - The player to attach to the Profile.

Returns:

Signals

OnProfileAdded

Fires:

Fires whenever a profile is added to the store.

Arguments:

  • Profile - The profile that was added.

OnProfileRemoving

Fires:

Fires right before a profile is removed from the store.

Arguments:

  • Profile - The profile thats being removed.

OnProfileCreated

Fires:

Fires whenever a profile is added that has no data attached to it, and was created for the first time.

Arguments:

  • Profile - The profile that was created.