Project 580: Minecraft in Roblox - Part Three

6. Update the GUI to Display 'Amount'

Code the text box to display the number stored in 'Amount'.
Starting point file for this challenge

Your goal

Steps

1. Add a local script to the textbox

In the Explorer window, click the plus sign next to your textbox, named 'Number', and add a local script.

2. Delete 'Hello World' code

Delete the default code in your local script.

3. Name the textbox in the script

Create a new local variable called 'textbox' and set it equal to the parent of the script.
local textbox = script.Parent

4. Make a forever loop

Make a loop that will run forever by using 'while true do''. This will run constantly to ensure that the number being displayed is always up to date.

Don't forget to hit the 'return/enter' key to get an 'end' statement.
while true do end

5. Get the value of 'Amount' and store it in 'amount'

Get the value of 'Amount', which is the child of the parent of the parent of the parent of the textbox. Store it in a local variable called 'amount'.
local amount = textbox.Parent.Parent.Parent.Amount.Value

6. Translate 'amount' into a string and store it in 'num'.

Use the function 'tostring' on 'amount' to translate it into text. Store it inside a local variable called 'num'.
local num = tostring(amount)

7. Set the Text of the TextBox to 'num'

Set the 'Text' property of the TextBox equal to 'num'. This will change the text displayed on the handle to that number.
textbox.Text = num

8. Change 'true' to 'wait(0.1)'

Replace the word 'true' in your while loop with 'wait(0.1)'. This makes it so that each time the loop runs, it waits 0.1 seconds before starting over. 
while wait(0.1) do end