Project 387: Lemonade Tycoon

20. Finish programming the lemonade stand purchase

Buying a lemonade stand also means spawning a lemonade stand, setting "purchased" to true and letting the computer know the player should start earning money.

Starting point file for this challenge

Steps

1. Spawn the lemonade stand in the world

Make the Workspace the parent of the "stand" variable.

Remember, parents hold things, so if the Workspace is the parent of the stand, then the stand will be held inside the Workspace with all your other game objects. 

stand.Parent = game.Workspace

2. Set the lemonade stand's position

Use the MoveTo function and a new Vector3 to set the stand to 10 units in front of your button. 

stand:MoveTo(button.Position + Vector3.new(-10,0,0))

3. Set purchased to true

Because you've now bought the lemonade stand, the "purchased" boolean variable should be set to true. 

purchased = true

4. Activate a "getmoney" function

Giving the player money is going to be a whole chunk of code, so it makes more sense to bundle it up in its own function that we'll call "getmoney." 

We'll make the rest of this function in the next step. 

The "getmoney" function will also have a parameter called "player" because it needs to know who to give coins to. 
getmoney(player)