Implementing a synchronized timer with UNET

This is probably a really nooby question, but I am trying to learn UNET, and have been looking everywhere for an answer to this without much success.

Basically, what I am trying to do is create a match timer. Once a certain number of players is reached, the clock starts ticking. My original plan was to use a syncvar gametime, and if(isServer) modify it. This worked just fine for the two players that were required to start the timer, but if another player connected at another time, their timer would start from scratch. On the docs it says that isServer “Returns true if this object is active on an active server.” Does this mean that code inside still runs on clients as long as they are connected?

Even when using [ServerCallback] on a method that modifies my timer, the time seemed to be ticking seperately for each client, rather than as a single master clock.

Is it possible to write a script that ONLY executes on the server (or the server part of the host), and that all clients (including the client part of the host) get their time from? How would I go about doing this?

Ok, so the problem was not what I thought it was, and after more experimentation, I discovered what I was doing wrong and updated the title accordingly. The server-side-only part was not the issue at all, and in fact was working just fine. The problem had to do with each instance managing its own time. The time was only getting changed on the server, but that time was different for each instance. This was fixed by making the host’s timer a master timer which all other clients get their time from.

If anyone else is having trouble doing this (Beware that this is designed for games with HOSTS, and will probably need some changes for games that have a bunch of remote clients:

public class GameTimer : NetworkBehaviour {
	[SyncVar] public float gameTime; //The length of a game, in seconds.
	[SyncVar] public float timer; //How long the game has been running. -1=waiting for players, -2=game is done
	[SyncVar] public int minPlayers; //Number of players required for the game to start
	[SyncVar] public bool masterTimer = false; //Is this the master timer?
	//public ServerTimer timerObj;

	GameTimer serverTimer;

	void Start(){
		if(isServer){ // For the host to do: use the timer and control the time.
			if (isLocalPlayer) {
				serverTimer = this;
				masterTimer = true;
			}
		}else if(isLocalPlayer){ //For all the boring old clients to do: get the host's timer.
			GameTimer[] timers = FindObjectsOfType<GameTimer>();
			for(int i =0; i<timers.Length; i++){
				if(timers*.masterTimer){*

_ serverTimer = timers ;_
* }*
* }*
* }*
* }*
* void Update(){*
* if(masterTimer){ //Only the MASTER timer controls the time*
* if(timer>=gameTime){*
* timer = -2;*
* }else if(timer == -1){*
* if(NetworkServer.connections.Count >= minPlayers){*
* timer = 0;*
* }*
* }else if(timer == -2){*
* //Game done.*
* }else{*
* timer += Time.deltaTime;*
* }*
* }*

* if(isLocalPlayer){ //EVERYBODY updates their own time accordingly.*
* if (serverTimer) {*
* gameTime = serverTimer.gameTime;*
* timer = serverTimer.timer;*
* minPlayers = serverTimer.minPlayers;*
* } else { //Maybe we don’t have it yet?*
* GameTimer[] timers = FindObjectsOfType();*
* for(int i =0; i<timers.Length; i++){*
_ if(timers*.masterTimer){
serverTimer = timers ;
}
}
}
}
}
}*_