Project 580: Minecraft in Roblox - Part Three

5. Create a Surface GUI and an IntValue to Your Block Tool

Add a IntVlaue to your block tool to keep track of number of blocks a player has in their 'inventory' and a Surface GUI to the handle to display that number.
Starting point file for this challenge

Your goal

Steps

1. Add an 'IntValue' to your tool and rename it 'Amount'

In the Explorer window, click on the plus sign next to your block tool and select 'IntValue'. You will use this to keep track of the number of blocks, of this material, that the player has.

2. Set the value of 'Amount' to 90

In the properties window for 'Amount', set the 'Value' to 90. This is going to be the maximum number of blocks a player can hold at a time.

3. Add a 'Surface GUI' to the handle of your block tool

Click the plus sign next to the handle of your block tool in the Explorer window and add a 'SurfaceGUI'. 

4. Set the SurfaceGUI's face to 'Back'

In the Properties window, find the 'Face' property of the SurfaceGUI and change it to 'Back'.

5. Add a TextBox to the SurfaceGUI and rename it

In the Explorer window, click the plus sign next to the SurfaceGUI you just added and select TextBox. Rename the TextBox 'Number'.

6. Set the size of the TextBox

Select the 'Number' TextBox in the Explorer window and find the Size property. Set the 'Scale' to 0.5 and the 'Offset' to 1 for both X and Y.

7. Hide the background and border of 'Number'

In the Properties window for 'Number', change the 'Background Transparency' equal to 1 and the 'BorderSizePixel' equal to 0.

8. Set the size and color of the text

Still in the Properties window for 'Number', set the 'TextSize' equal to 18 and change the 'TextColor' to a color that will show up on your block. 

If your block is light colored, you could use black. If it is dark colored, try using white.