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);
}