API > SyncVar > OnVariableChange
SyncVar.OnVariableChange⚓︎
Read-Only
This property is Read-Only
Name | Type |
---|---|
OnVariableChange | EventHandler |
Event callback function requirement⚓︎
Info
This property is an event. It means that you need to add a listener function to it. Here how that function needs to look like.
function(any value);
Parameters⚓︎
Name | Type | Description |
---|---|---|
value | any | The new value of the variable. |
Usage⚓︎
--- @type
local syncvar;
--- callback function called when event triggers
--- @param any any
local function CallBack(any)
-- code to handle event call back
end
-- Regsiter callback function
syncvar.OnVariableChange.Add(CallBack);
Description⚓︎
Event handler that invokes when the value of the Synchronized variable changes by any clients.