replica:ListenToChange<V>(path: Path, listener: (new_value: V, old_value: V | nil, changed_path: Path) -> ()): () -> ()

Server & Client

Fires when SetValue writes to path, or to any descendant of path (bubbling). changed_path tells you exactly which path was mutated, which matters when listening on an ancestor.

Parameters

path*
Path
Path to listen on. Matches exact writes and bubbled writes from deeper paths.
listener*
SetListener<V>
Called with the new value, the previous value and the exact path that changed.

Returns

() -> ()Disconnect function.
replica:ListenToChange({"Inventory"}, function(new, old, changedPath)
    print("Something changed under Inventory at", table.concat(changedPath, "."))
end)