setElementData
Client
Keeps a piece of data on an element, on this client only.
Also exists on the server, with its own implementation: setElementData
bool setElementData(element element, string key, any value [, bool|string sync = true])
Parameters
| Name | Type | Description |
|---|---|---|
| element | element | The element. |
| key | string | The data's name. Keys over 128 characters are cut, with a warning. |
| value | any | The value to keep. |
| sync | bool|string | Accepted as on the server (true, false, "broadcast", "local" or "subscribe"), but ignored. Any other value raises an error.default true |
Returns
true if it was kept, false if the element already held that same value.
Fires onClientElementDataChange. Cancelling the event does not undo the change.
Example
setElementData(localPlayer, "hud.visible", false)
if getElementData(localPlayer, "hud.visible") == false then
outputDebugString("hud hidden")
endNoteThe data never reaches the server or the other clients, whatever
sync says.