Project 387: Lemonade Tycoon

5. Finish filling out the variables

The script doesn't know what these variables refer to yet, or their names or starting values.
Starting point file for this challenge

Steps

1. Tell the script what the local variable "leaderstats" means

"Leaderstats" is going to equal a new model we're creating - in other words, you're going to create a new instance of a model, called "leaderstats." 

A model is just an object that holds scripts and parts together. 

local leaderstats = Instance.new("Model")

2. Tell the script what the local variable "coins" means

Coins is going to equal a new IntValue object we're creating. 

An IntValue object is an object that holds a number (so, similar to a variable, but other parts of the game can read them easier.) You have to create the IntValue object by telling Roblox to create a new instance of the IntValue. 

local coins = Instance.new("IntValue")

3. Name the leaderstats model

We'll name it "leaderstats" as well, to stay organized. 

leaderstats.Name = "leaderstats"

4. Attach leader stats to the player

Set the player as the leaderstat's parent (remember, parents hold things, so if the player is the parent of the leaderstats, then the player is holding the leaderstats model.) 

leaderstats.Parent = player

5. Name the coins IntValue

We'll name it "coins" as well, to stay organized. 

coins.Name = "coins"

6. Attach the coins to your leaderstats

Set the leaderstats as the coin's parent (remember, parents hold things, so if the leaderstats is the parent of the coin, then the leaderstats are holding the coin.) 

coins.Parent = leaderstats

7. Set the coins starting value

How many coins do you want your player to start with at the beginning of the game? 

(It'd probably be impossible for the player to start with less coins than the cost of their first lemonade stand, so the example starts with 100 coins.)

8. Repeat for lemons

Make lemons a new IntValue, name the lemons IntValue, attach them to your leaderstats and set their starting value. 

(The starting value right now could be anything, so you can give them 0 lemons or 100, whatever you want.) 

local lemons = Instance.new("IntValue") lemons.Name = "lemons" lemons.Parent = leaderstats lemons.Value = 1