Project 387: Lemonade Tycoon

15. Setup variables for the BuyStand script

Copy and paste this list of variables into the top of your script. The picture below explains what each variable means if you want to test out your own values, but the example values are in the steps! 

local stand =
local purchased =
local button = 
local income = 
local income_delay =
local cost =

Starting point file for this challenge

Your goal

Steps

1. Set the stand variable

This variable will tell Roblox where to find the lemonade stand (the one we hid inside the ServerStorage closest.) It will also tell Roblox to clone the lemonade stand for us. 

local stand = game.ServerStorage.LemonadeStand:Clone()

2. Set the purchased variable

This is a boolean variable. It will help make sure we can only buy 1 lemonade stand per button. Set it to false at the start of the game. 

local purchased = false

3. Set the button variable

This variable will tell Roblox where to find the button object. The button object is currently holding the script, which means it's the parent of the script. 

local button = script.Parent

4. Set the income variable

This variable will set how many coins a player makes by selling lemonade. 

local income = 10

5. Set the income_delay variable

This is how many seconds it will take for the lemonade stand to sell lemonade and earn you money. In the example, every 5 seconds, the lemonade stand would eventually use up some of your lemons and give you 10 coins. 

local income_delay = 5

6. Set the cost variable

This is how much it costs to buy the lemonade stand. 

local cost = 100