Project 387: Lemonade Tycoon

6. Run the leaderboard function when the player loads

Right now, the function isn't doing anything yet, because we haven't told it to run yet. It's like a chunk of code in Scratch without a "when green flag clicked" event on top! Run the code during a "PlayerAdded" event. 
Starting point file for this challenge

Your goal

Steps

1. Create a PlayerAdded event

At the end of your code, after your function ends, create an event that is listening for when a player is added. 

This is kind of like an imaginary Scratch block called "when Roblox loads my game" 
game.Players.PlayerAdded

2. During a PlayerAdded event, run your "leaderboard" function

Connect your "leaderboard" function when the player gets loaded in. 

This is like imaginary Scratch code that says something like, "when Roblox loads my game, give the players a leaderboard." 
connect(leaderboard)

3. Test it out!

Test your new code out! Are you able to see the leaderboard?