Getting a players total time played?

Hi, I’m making a hud that will show the players how long they have played on the server since they first joined. What would i use to find out how much time they have played? Thanks.

You can use the TimeConnected function, but do note that this ONLY gives you the time since they connected in the current session.
To get the full play time, you will need to save this value (plus the previous saved value) every time they leave the server (or server ShutDown).
Then, when they join again you add that saved value with the TimeConnected value.

Pseudocode:



On player join:
	Get the saved value
	Set ply NW var to saved value
On draw:
	Draw the localply NW var + time connected (curtime difference between join and curtime)
On player leave:
	Save ply NW var + ply:TimeConnected()


Note that TimeConnected is serverside, so you must use CurTime or any other means of measuring time between join and the current time.

Thanks!