January 2021
Posted 3 years ago
You'd think a scoreboard is easy to do. Just get the list of players, draw their names and scores, right? Nope. The problem is that your client might not be aware of the player because it's somewhere else on the map and isn't being networked to you. 

We need to send specific statistics in a way that isn't linked to the player entity. And since we're awesome, we want a way that can be extended by addons and gamemodes without having to alter the original code.

We call this PlayerInfo. The player class has functions to Set and Get it. You can implement it in a property like this.
attribute 'class' not allowedattribute 'contenteditable' not allowedattribute 'blocktype' not allowed
So then you can use Deaths as a regular variable.

On the client UI side, you interact with PlayerInfo via the PlayerInfo class.
attribute 'class' not allowedattribute 'contenteditable' not allowedattribute 'blocktype' not allowed
This class, with its Added/Updated/Removed hooks lets you make a scoreboard really easily.