Skip to content

Change Information Types

ChangeInfo

Enhanced type for change information in client listeners.

lua
export type ChangeInfo = {
    action: "Set" | "SetValues" | "TableInsert" | "TableRemove",
    path: {string},
    index: number?,
}

Action Types:

  • "Set": Single value change
  • "SetValues": Multiple values changed
  • "TableInsert": Item added to array
  • "TableRemove": Item removed from array

Properties:

  • action: The type of change that occurred
  • path: Array of path segments that changed
  • index: Optional index for array operations

Example Usage:

lua
PlayerState.OnChanged(".", function(newValue, oldValue, info)
    if info and info.action == "TableInsert" then
        print(`Item added at index {info.index} to {table.concat(info.path, ".")}`)
    end
end)

ChangeCallback

Listener callback type shared by server and client change subscriptions.

The third argument is either:

  • A path key array for simple sets — e.g. { "Coins" }
  • A ChangeInfo table for table inserts/removes and nested updates

See the server and client listener pages for examples of each shape.

lua
export type ChangeCallback = (newValue: any, oldValue: any, changeInfo: ChangeInfo | {string}?) -> ()

PlayerState - High-Performance Roblox Data Management