Always a solution:
Reduce elementdata updates.
Every time you call setElementData(without disabling synchronization), it will send data. (even if the value is the same)
I often see people do this: (clientside)
addEventHandler("onClientRender", root,
function ()
local data = "random data"
setElementData(localPlayer, "key", data)
end)
He,
Frame 1: please update (16 ms later)
Frame 2: please update (16 ms later)
Frame 3: please update (16 ms later)
Etc.
Not even a second has past and you almost requested 62 UPDATES! (not sure if there is elementdata reduction clientside, but I don't think so)
Which is IDIOTIC! (for the ones who do this, please go in your microwave)
Which should/could be done like this:
addEventHandler("onClientRender", root,
function ()
local data = "random data"
if data ~= getElementData(localPlayer, "key") then
setElementData(localPlayer, "key", data)
end
end)
Or this: (serverside)
-- element could be a team
for key, data in ipairs(example) do
setElementData(element, "score", getElementData(element, "score") + 1)
end
Updating the score to 20? = Tell all clients/players 20x > "I have grown 1 more!"
Which is stupid.
Should/could be done like this.
local score = getElementData(element, "score") or 0
for key, data in ipairs(example) do
score = score + 1
end
setElementData(element, "score", score)