Decreasing a value by delta time on server?

To decrease cooldowns (e.g. for spells), I usually use

SpellCooldown -= Time.deltaTime;

However, how do I handle this nicely on a networked game? What I can think of is:

[Syncvar(hook="OnCooldown")]
public float SpellCooldown; 

void Update()
{
    if(!isServer)
        return;

    RpcDecreaseCooldown();
}

[ClientRpc]
void RpcDecreaseCooldown()
{
    SpellCooldown -= Time.deltaTime;
}

void OnCooldown(float newCooldown)
{
    SpellCooldown = newCooldown;
}

If this code has to run on the server and ClientRpc it every frame, wouldn’t this take a lot of bandwidth? What is a better way to approach this? Thanks in advance!

While transferring the value of a float wouldn’t take up too much bandwidth, you’d encounter some issues trying to transfer it every frame Update. In my project I don’t bother syncing Cooldowns, only when the cast starts and when it finishes. The player received the total cooldown time from the server when the cooldown starts, and counts it down without using the network. The Server though is the only one that can finish the cooldown though, so players can’t influence it. Here’s how i run cooldown systems:

[ClientRpc]
void RpcCooldown(float Countdown)
{
	StartCoroutine(Cooldown(Countdown));
}

IEnumerator Cooldown(float Countdown)
{
	while(!Flag)
	{
		Countdown -= Time.deltaTime;
		
		if(Countdown <= 0)
		{
			Flag = true;
		}
		yield return new WaitForFixedUpdate();
	}
	if(isServer)
	{
		//Finalize Cooldown
	}
}

You’d call RpcCooldown() from your server and pass the length of the cooldown. From there all of your clients (including the one acting as the server) would count down the cooldown on their own. Once the cooldown finishes only the Server runs the final cooldown process, which can then be sent to all clients via the ClientRpc.

EDIT: forgot to put ‘new’ in the yield return line.