Skip to content

AttributeGroup

Groups of Roblox Instance attributes that share a common prefix. Useful for creating property tables such as Dismounts in Dismounters.

function AttributeGroup.__call(
self: AttributeGroup<T>,
instance: Instance
): std.Map<string, T>

Syntax sugar for AttributeGroup:get(instance).

The attribute.

The instance to get the attribute from.

All values.`


function AttributeGroup.__tostring(self: AttributeGroup<T>): string

Metamethod to transform the option into a string.

The attribute to stringify.

The string representation of the attribute.`


function AttributeGroup.changed(
self: AttributeGroup<T>,
instance: Instance,
callback: (key: string, value: T) -> ()
): RBXScriptConnection

Connects a callback function to be invoked when any of the attributes tracked by this AttributeGroup change on an instance. The callback will receive the extracted key and the new value of the changed attribute.

The attribute.

The instance to track the attribute.

A function to call when a relevant attribute changes, receiving the key and the new value.

Can be used to disconnect the callback.`


function AttributeGroup.get(
self: AttributeGroup<T>,
instance: Instance
): std.Map<string, T>

Returns all values with from attributes with the given prefix from the given instance. If config.typecheck is enabled, values are checked against the attribute’s type.

The attribute.

The instance to get the attribute from.

All values.`