[HELP] State Bags Error

Hi guys this is my small code giving a car a state bag and based on this state bag i am doing other things like disabling engine and show him notification as shown in my code below.

--client
function ImpoundVehicle (TargetVeh)
    local vehProps = ESX.Game.GetVehicleProperties(TargetVeh)
    local vehEntity = NetworkGetNetworkIdFromEntity(TargetVeh)
    Entity(TargetVeh).state:set('Clamped', true, true)
end

Citizen.CreateThread(function ()
    while true do       
        while ESX == nil do
            Wait (0)
        end
        if IsPedInAnyVehicle(PlayerPedId(), false) then 
            local veh = GetVehiclePedIsIn (PlayerPedId(), false)
            if Entity(veh).state.Clamped == true then 
                ESX.ShowHelpNotification ("This Vehicle Is Impounded Call Mechanic.", true, false)
                SetVehicleEngineOn (veh, false, true, true)
            end
        end
        Wait(2000)
    end
end)

the problem here is when i use this function on my car and ride my car and try to turn engine on the engine gets off auto and it gives me the notification as shown but when i use the function on my car and another player come and enter my vehicle he can move with it and no notification appear to him my question here isn’t the state bags has to be synced over all clients ? or i have to manually trigger server event and then send back trigger client event to all clients to be synced ? or i have to set it in server side so it will be synced for all clients and if i have to server side can any one give me that block of code bec when i do it myself it gives me strange error as shown below

--server side
RegisterNetEvent("ClampVehicle")
AddEventHandler("ClampVehicle", function (VehObj)
    local veh = NetworkGetEntityFromNetworkId(VehObj)
    while not (DoesEntityExist(veh)) do 
        Wait (0)
        print("Getting Vehicle ... ")
    end
    Entity(veh).state.Clamped = true
    clampedVehs[VehObj] = veh
end)

it gives me this error

or i have to manually trigger server event and then send back trigger client event to all clients to be synced ?

state bags are onesync specific meaing u need onesync to be able to utalize them thats if you are not using onesync already, i believe the state set from the server is replicated to all clients and state set from clients is not replicated unless its a global state however other states can be read, clients cant update global states (as far as im aware)

Update your server artifact

I am using onesync actually

I will try this and tell u back
But u mean bec of the error appear server side i have to upgrade my server artifact?