Lesson 2 – BuyEggScript

Coding the Script

  1. Create an if then statement on Line 5. The condition is if the player’s Cash value is greater than or equal to the cost, then the script will do something.
  1. Now subtract the Cost from your Cash Value underneath the if then statement on Line 6.

Create a Local Variable

Now you will use a local variable called pet to access the PetModule Script. On Line 7 add a variable called Pet. Underneath this variable, we will print the petName that was selected.

Create a New String Value

Strings are an important component of scripting, as they are used to represent sequences of letters, numbers, and symbols. Create a StringValue. You will also assign two new variables.