State bag rate limit / state bags not replicating
A script is updating shared information far too often, so some of those updates are being thrown away.
Do this first
This needs a change in the script — it should update when something changes, not constantly.
What it means
State bags are rate limited per entity. Writing faster than the limit means updates are dropped, throttled, or in bad cases the server spends all its time replicating. Nothing errors — the value simply does not arrive on the client, or arrives late.
What causes it
Ordered by how often it is the answer.
- 1
Writing a state bag every tick
The limit exists precisely to stop this. Fuel, speed and position written every frame will be throttled.
- 2
Very large values
A whole inventory in a state bag is replicated to everyone in scope on every change. A payload that size at any frequency is a problem.
- 3
Many bags on one entity
Dozens of keys on the same entity, each replicating separately.
- 4
Replicated when it did not need to be
:set(key, value, true)replicates. Local-only state should passfalse. - 5
Reading a bag on a client that cannot see the entity
Out of scope means no bag. Not a rate limit, but the same symptom of "the value is not there".
How to tell which one is yours
Write once and read it: if a single write arrives and a loop of writes does not, it is the rate limit. If neither arrives, the entity is out of scope.
Where to look
Every .state:set in the resource, and how often it runs.
How to fix it
Write only on change, and only what has to cross the network:
local last
CreateThread(function()
while true do
Wait(1000) -- not 0
local fuel = math.floor(GetFuel(veh))
if fuel ~= last then -- only on change
last = fuel
Entity(veh).state:set('fuel', fuel, true)
end
end
end)Still stuck on your own code?
This page is what this error usually means. Paste your console into Server Fixer and it will rank everything in it and tell you what to do first, and if you would rather not touch it, ORBIE can repair the script and hand the resource back ready to drop in.
bug_reportOpen Server Fixer