Sign in
Home
Online Classes
Instructors
Tutorials
☰
Register
Sign in
Online Classes
Instructors
Tutorials
1. Open your file from part 2
2. Add a Toughness Value to the Blocks Being Placed
3. Keep Track of When the Player Clicks with the Pickaxe
4. Let the Pickaxe Break Blocks Based on Toughness
5. Create a Surface GUI and an IntValue to Your Block Tool
6. Update the GUI to Display 'Amount'
7. Change 'Amount' Whenever the Player Places a Block
8. Allow the Player to 'Pick Up' the Blocks They Break
9. Multiple Types of Blocks
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
Hint: show steps
Steps
1. Add a local script to the textbox
Hint: show details
In the Explorer window, click the plus sign next to your textbox, named 'Number', and add a local script.
Hint: show image
2. Delete 'Hello World' code
Hint: show details
Delete the default code in your local script.
3. Name the textbox in the script
Hint: show details
Create a new local variable called 'textbox' and set it equal to the parent of the script.
local textbox = script.Parent
Hint: show image
Hint: show code
4. Make a forever loop
Hint: show details
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
Hint: show image
Hint: show code
5. Get the value of 'Amount' and store it in 'amount'
Hint: show details
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
Hint: show image
Hint: show code
6. Translate 'amount' into a string and store it in 'num'.
Hint: show details
Use the function 'tostring' on 'amount' to translate it into text. Store it inside a local variable called 'num'.
local num = tostring(amount)
Hint: show image
Hint: show code
7. Set the Text of the TextBox to 'num'
Hint: show details
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
Hint: show image
Hint: show code
8. Change 'true' to 'wait(0.1)'
Hint: show details
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
Hint: show image
Hint: show code
×
×
Provide your email address for immediate project access
Email
Check your email for instructions on how to create a full DA account