Server side entity state bags sync when replicate is false

Expected results:
Be able to set replicated to ‘false’ server side and it not sync to the client

Actual results:
Ignores the replicate value and syncs anyways.

Entity(veh).state:set('stateKey', stateValue, --[[ replicate ]] false)

?

Both client and server can use this, except on client replicate is false by default and on server it’s true by default for direct __newindex calls.

If it ‘doesn’t work’, that’s more likely your issue.

		__newindex = function(_, s, v)
			local payload = msgpack.pack(v)
			SetStateBagValue(es, s, payload, payload:len(), isDuplicityVersion)
		end
			if s == 'set' then
				return function(_, s, v, r)
					local payload = msgpack.pack(v)
					SetStateBagValue(es, s, payload, payload:len(), r)
				end
			end

So… good job requesting something that already exists, and assuming you need to manually invoke set() on the client?

Weird, because this is exactly what I tried, but it still replicated to the client

local entState = Entity(veh).state
entState:set('vehId', vehId, false)
entState:set('serverSpawned', true, true)

cmd_nrFSJ6Nsw9

FiveM_b2189_GTAProcess_POY2StC9Jy

Not entirely sure how it’s a ‘me’ problem either unless I’m just outright using it wrong or assuming something wrong.

1 Like

Might be a bug, then?

Seems that way, sorry for the late response, here’s a resource mimicking what I’m trying to do, except for the players name. No matter what the state owner is always sync’d to the client.

statebag-test.7z (805 Bytes)