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
7. Change 'Amount' Whenever the Player Places a Block
Change the existing code inside your block tool to decrease the value of amount whenever you place a block, and only allow the player to place a block if 'Amount' is greater than 0.
Starting point file for this challenge
Your goal
Hint: show steps
Steps
1. Open your tool script
Hint: show details
Open the script inside your block tool.
2. Add an 'amount' variable
Hint: show details
At the beginning of your code, create a new local variable called 'amount' and set it equal to Tool.Amount.
local amount = Tool.Amount
Hint: show image
Hint: show code
3. Make a new line at the end of your 'makeBlock' function
Hint: show details
Find the last line of your 'makeBlock' functions and add a new line after it.
Hint: show image
4. Subtract 1 from 'Amount' when a block is placed
Hint: show details
At the end of you 'makeBlock' function, make a new line the sets 'amount.Value' equal to 'amount.Value - 1'.
amount.Value = amount.Value - 1
Hint: show image
Hint: show code
5. Make a new line after the line that checks the player's distance in 'onClick'
Hint: show details
Go into the 'onClick' function and find the line that checks if 'distance' is less than 'PlaceDistance'. Make a new line after it.
Hint: show image
6. Check if 'amount.Value' is less than 1
Hint: show details
Use and 'if-then' statement to check if 'amount.Value' is less than 1.
Don't forget to hit the 'return/enter' key to get an 'end' statement.
if amount.Value < 1 then end
Hint: show image
Hint: show code
7. Return if amount is less than 1
Hint: show details
Use the word 'return' to exit the function if the player does not have any blocks left.
return
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