client is not allowed to write to this network variable

altho the code still works im gettin an error “client is not allowed to write to this network variable”
this is the networkvar with the error;

NetworkVariable secCount = new NetworkVariable(0, NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission.Owner);

and this is the code where the exception is thown
[in the second last code statement]

 [ServerRpc(RequireOwnership = false)]
    private void LoadAmmoServerRpc(int seccount, byte ammo)
    {
        LoadAmmoClientRpc(seccount, ammo);
    }
    [ClientRpc]
    private void LoadAmmoClientRpc(int seccount, byte ammo)
    {
        if (seccount <= 0 || secCount.Value > 0) return;
        ammoChange(ammo);
        secCount.Value = 2;
        MyEvents.UpdateSecAmmoUI?.Invoke(ammo);
    }

Your client RPC is being sent to every client, but only the owner has permission to write to it. You want something like:

if(IsLocalPlayer)
{
    secCount.Value = 2;
}

My suggestion though is get rid of the owner permission entirely, and instead set the value in your ServerRPC. Currently the client can set secCount to whatever they want, meaning cheaters can and will abuse whatever secCount is.

It’s also unlikely that turning off RequireOwnership on the ServerRPC is what you really want.