Project 580: Minecraft in Roblox - Part Three

9. Multiple Types of Blocks

When you have multiple types of blocks (multiple block tools of different materials) you must adjust your code to allow for those other types of blocks to be picked up. 
Starting point file for this challenge

Your goal

Steps

1. Find the line that sets 'toolBlock' to the tool in the player's backpack

Find the line in your 'pickUp' function that sets 'toolBlock' equal to the the tool in the player's backpack. It should look like this:

toolBlock = backpack:FindFirstChild("Stone")

Make a new line AFTER this one.

2. Add an 'elseif' to your 'if-then' statement

Type the word 'elseif' on the new line and hit 'return/enter'.
elseif end

3. Check if the material of 'block' is a new material

Use the 'elseif' to check if 'block.Material' is equal to 'Enum.Material.Wood'. Hit return to get an end statement.

If you made your other block tool a different material, use that instead of wood.
elseif block.Material == Enum.Material.Wood then end

4. Find the 'Wood' tool in backpack and store it in 'toolBlock'

Use the 'FindFirstChild()' function on 'backpack' to find the Wood block tool in the player's inventory. Store the result in the 'toolBlock' variable.

If you named your block tool something different, use that instead of 'Wood'.
toolblock = backpack:FindFirstChild("Wood")