Now that we are tracking player scores, we can build a scoreboard.
Bring out a new script, let’s name it scoreboard. First, let’s bring over When Player Enters World. From our values tab, grab Set Player Persistent Variable. Then drag in the green Player pill, and select score from the drop down. Now when a player enters our world, their score starts at zero.
From the Variables tab, we are going to create a Player List. Let’s call it CurrentPlayers, make sure to select type Player, and toggle list on. You will know you’ve created a list because there are brackets around the type icon.
From the bottom of our Operators tab, drag the Add to List codeblock into the Player Enter event. We can then drag the green player pill to the left, and the new list variable to the right.
Next, bring the When Player Exits World event over. And back on our Operators tab, bring over the Remove Item at Index From List codeblock. This requires a number value, the index of the item, which we can get by using the Index of Item in List codeblock. Now you drag the green player pill, and fill out both empty list slots with our list variable.
Great work! You are now tracking the current players in your world