Class
ConfigService
NotCreatableServiceNotReplicated
A game service that gives access to in-experience configuration with updates in real time.
ConfigService exposes methods for getting ConfigSnapshot objects.
Configs can only be accessed by game servers, so you can't use
ConfigService within client scripts.
See Experience configs for an in-depth guide on managing keys, deploying real-time updates, error handling, limits, and more.
Methods 4#
| ClearTestingValue | Clears current testing value for the given key. |
| GetConfigAsync | Retrieves a snapshot of the latest configuration.Yields |
| GetConfigForPlayerAsync | Retrieves a snapshot of the latest configuration for a specific player.Yields |
| SetTestingValue | Sets a testing override for the given key. |
ClearTestingValue(key: string): ()#
Removes a testing override created by the
SetTestingValue() function. The
actual configured value will be returned after calling this function.
| Name | Type | Default | Description |
|---|---|---|---|
key | string | Key of the configuration to clear testing value for. |
Returns
()
GetConfigAsync(): ConfigSnapshot#
Yields
This function retrieves the latest available configuration as a
ConfigSnapshot instance without player targeting. Snapshots can be
refreshed to the latest values by calling
ConfigSnapshot:Refresh().
Experiments are not applied since there is no player context.
If configuration fails to load and there is no previously available configuration, this function throws an error.
Returns
ConfigSnapshot— AConfigSnapshotinstance with the latest configuration.
GetConfigForPlayerAsync(player: Player): ConfigSnapshot#
Yields
Retrieves the latest available configuration as a ConfigSnapshot
instance targeting to the given player. Snapshots can be refreshed to the
latest values by calling ConfigSnapshot:Refresh().
This function applies all experiments running for the player.
If configuration fails to load and there is no previously available configuration, this function throws an error.
| Name | Type | Default | Description |
|---|---|---|---|
player | Player | The player to get the configuration for. |
Returns
ConfigSnapshot— AConfigSnapshotinstance with the latest configuration targeted to the player.
SetTestingValue(key: string, value: Variant): ()#
Sets a testing override for the specified configuration key in the current
server instance. When a testing value is set, calls to
ConfigSnapshot:GetValue() for that key will return the testing
value instead of the actual configured value.
Testing values can be cleared by calling the
ClearTestingValue() function.
| Name | Type | Default | Description |
|---|---|---|---|
key | string | Key of the configuration to override with a testing value. | |
value | Variant | Value to set as the testing override. |
Returns
()
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild