Project 387: Lemonade Tycoon

22. Check to see if the player is able to make lemonade

The player needs to have enough lemons in their inventory before they can start making lemonade! Otherwise that lemonade would be coming out of thin air.

Starting point file for this challenge

Steps

1. Create a forever loop

A forever loop written in Lua is simply the line "while true do." Then, hit return to create an "end" to this forever loop. 

Whatever's in between the "do" and the "end" will happen forever. 

while true do end

2. Create an if-then statement that checks if the player has at least 1 lemon

Check to see if lemons is greater than or equal to 1. 

Remember to hit return on your keyboard to create an "end" to this if-statement. 

if lemons.Value >= 1 then end

3. Access the lemon variable

Just like the coins variable, the lemons variable is actually hiding in another script - the leaderstats script, in the player. 

player.leaderstats.lemons.Value