problem accesing a sync var from another script

i’m using a sync var attribute to sync a float from the server. the float is incremented every frame.
Here’s the code:
using UnityEngine;
using UnityEngine.Networking;

public class SyncTest : NetworkBehaviour
{
    [SyncVar]
    public float t;

    void OnGUI()
    {
        GUI.Label(new Rect(10 , 150 , 100 , 20) , t.ToString());
    }

    void Update()
    {
        t++;
    }
}    

when i try accessing the float t from another script and debug it it keeps showing 0.

you should change this variable by server
for example you can assign [Command] attribute to a function and then try to change the variable

[syncvar]
public float f;

[Comand]
public void CmdChangeTheVariable()
{
        f++;
}

void Update()
{
        CmdChangeTheVariable();
}