- Documentation
- Client events
- onClientElementDataChange
Event
onClientElementDataChange
New event!Added to Trilogy Hub on 3 Nov 2026.
An element's data changed - through setElementData on the server or in a client script.
Handler
addEventHandler("onClientElementDataChange", root, function(key, oldValue, newValue) ... end)Parameters
keystring- Key name.
oldValueany- Previous value (
nilwhen the key did not exist). newValueany- New value (
nilafter the key was removed).
Source
source is the element whose data changed.
Example
addEventHandler("onClientElementDataChange", localPlayer, function(key, old, new)
if key == "money" then outputChatBox("Pieniądze: " .. tostring(new)) end
end)
See also
onElementDataChangeAn element's data changed (setElementDataorremoveElementData), also from a client.setElementDataStores a value under a key on an element. By default the value is sent to all players, which firesonElementDataChange.getElementDataReturns an element's data value under a key. Data is set withsetElementData; broadcast data is visible on the client too.