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 ​

Shared by server OnChanged / OnSharedChanged and client listeners. The third argument is either a path key array (e.g. { "Coins" }) or a change table (ChangeInfo) depending on the mutation — see Server OnChanged and Client OnChanged.

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

PlayerState - High-Performance Roblox Data Management