You are referring to a Block game object not the object being hit by the array. To change the object the raycast hits use the hit variable. This stores all info about the object including its material and colour.